How to know whether player have joined room before when he disconnected?

I want to know that how to determine whether player joined a room and play before he disconnect(internet problem) and rejoin room. Or that just need use photonnetwork.reconnectandrejoin no matter which scenario player have?if I did that will cause which problem?

Comments

  • Hi @k3921,

    if the client attempts to ReconnectAndRejoin but hasn't joined a room before, a warning is logged to the console and the connection process will fail.

    To avoid this you can set a boolean value inside the OnJoinedRoom callback and check this value before attempting to ReconnectAndRejoin.
  • @Christian_Simon
    So that I just need to set a private boolean such as IsJoined=true in OnJoinedRoom() method, in Disconnect callback check if this boolean is true. if is true reconnect and rejoin?
  • Hi @k3921,

    Thank you for choosing Photon!

    I have been playing with this and doing some tests, I think PhotonNetwork.inRoom stays true after an unexpected disconnection while the player was in a room.

    You could also try this script I'm working on. It's a component to enable QuickRejoin when possible, just add it to the scene preferably with DontDestroyOnLoad.
  • @JohnTube
    Thank you, I will take it a try
    is that just need to drag and drop in a gameobject at the first scene in the game?
Sign In or Register to comment.