JoinRandomRoom failed. Client is not on Master Server . . . (appears to be in error)
I receive this error when switching rooms (I leave and then join a new one after getting OnLeft()), but it works as expected.
The full error is: JoinRandomRoom failed. Client is not on Master Server or not yet ready to call operations. Wait for callback: OnJoinedLobby or OnConnectedToMaster.
Why would I get OnJoinedLobby or OnConnectedToMaster? I am already connected and have a lobby, I am just changing rooms. And, please confirm, OnConnectedToMaster is for use with OfflineMode?
Is this error message in error, or do I need to fix something?
The full error is: JoinRandomRoom failed. Client is not on Master Server or not yet ready to call operations. Wait for callback: OnJoinedLobby or OnConnectedToMaster.
Why would I get OnJoinedLobby or OnConnectedToMaster? I am already connected and have a lobby, I am just changing rooms. And, please confirm, OnConnectedToMaster is for use with OfflineMode?
Is this error message in error, or do I need to fix something?
0
Best Answers
-
Hi @flyingaudio,
a client can't be connected to a lobby and a room at the same time. In other words: when the client is in a lobby and tries to join a room, that client will leave the lobby and then joins the room. You can check this out by implementing the related callbacks - OnLeftLobby and OnJoinedRoom. When the client leaves a room, OnLeftRoom is called. If OnJoinedLobby is called, depends on if you either usePhotonNetwork.JoinLobby();
now or ifPhotonNetwork.autoJoinLobby
is enabled. OnConnectedToMaster will be called, ifPhotonNetwork.autoJoinLobby
is disabled.5 -
1) If I disabled Auto Lobby, could I bypass OnJoinedLobby() and go straight to CreateRoom or JoinRoom without error, and save the lobby creation time? Is that recommended?
This is possible. If autoJoinLobby is disabled,void OnConnectedToMaster()
will be called instead of OnJoinedLobby(). As soon as a client is connected to the MasterServer he can create a room.2) OnConnectedToMaster() is called when I Disconnect() and enable offlineMode. Do I understand correctly, that is the way to switch to offline mode?
When you disconnect from Photon,void OnDisconnectedFromPhoton()
will be called. OfflineMode can only be enabled when the client is not connected. To enable it you have to usePhotonNetwork.offlineMode = true;
. You can find more information about the OfflineMode on this documentation page.5
Answers
-
Hi @flyingaudio,
a client can't be connected to a lobby and a room at the same time. In other words: when the client is in a lobby and tries to join a room, that client will leave the lobby and then joins the room. You can check this out by implementing the related callbacks - OnLeftLobby and OnJoinedRoom. When the client leaves a room, OnLeftRoom is called. If OnJoinedLobby is called, depends on if you either usePhotonNetwork.JoinLobby();
now or ifPhotonNetwork.autoJoinLobby
is enabled. OnConnectedToMaster will be called, ifPhotonNetwork.autoJoinLobby
is disabled.5 -
Thanks. Auto lobby is enabled, and I was trying to join a new room right after OnRoomLeft(), but letting OnJoinedLobby() call the room creation took care of the error.
1) If I disabled Auto Lobby, could I bypass OnJoinedLobby() and go straight to CreateRoom or JoinRoom without error, and save the lobby creation time? Is that recommended?
2) OnConnectedToMaster() is called when I Disconnect() and enable offlineMode. Do I understand correctly, that is the way to switch to offline mode?0 -
1) If I disabled Auto Lobby, could I bypass OnJoinedLobby() and go straight to CreateRoom or JoinRoom without error, and save the lobby creation time? Is that recommended?
This is possible. If autoJoinLobby is disabled,void OnConnectedToMaster()
will be called instead of OnJoinedLobby(). As soon as a client is connected to the MasterServer he can create a room.2) OnConnectedToMaster() is called when I Disconnect() and enable offlineMode. Do I understand correctly, that is the way to switch to offline mode?
When you disconnect from Photon,void OnDisconnectedFromPhoton()
will be called. OfflineMode can only be enabled when the client is not connected. To enable it you have to usePhotonNetwork.offlineMode = true;
. You can find more information about the OfflineMode on this documentation page.5 -
Thanks for the answers. Still working on it...0