A bug in PhotonNetwork.IsConnectedAndReady?

Its documentation says "A refined version of connected which is true only if your connection to the server is ready to accept operations like join, leave, etc.", but in the code it checks only if the connection state one of these cases:

case ClientState.PeerCreated:

case ClientState.Disconnected:

case ClientState.Disconnecting:

case ClientState.DisconnectingFromGameServer:

case ClientState.DisconnectingFromMasterServer:

case ClientState.DisconnectingFromNameServer:

case ClientState.Authenticating:

case ClientState.ConnectingToGameServer:

case ClientState.ConnectingToMasterServer:

case ClientState.ConnectingToNameServer:

case ClientState.Joining:

case ClientState.Leaving:

  return false;  // we are not ready to execute any operations


So, when i'm in state ConnectedToNameServer trying to create a room, it fails to do so

Answers

  • Yes. You can send operations (which is what IsConnectedAndReady tells you) but you can't send all operations to any server.

    By now, definitely just use the callbacks: OnConnectedToMasterServer() is the one you'd need to join a room.