How to know whether player have joined room before when he disconnected?
Options
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?
0
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.0 -
@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?0 -
Hi @k3921,
Thank you for choosing Photon!
I have been playing with this and doing some tests, I thinkPhotonNetwork.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.0