Handling Disconnection issues
HI , i want to know how to properly handle disconnection in photon. When a player is currently on a dungeon and he / she disconnects. Do I put a reconnect and join on the OnPhotonDisconnect function but will i be able to spawn the player on his previous position ? + my camera is attached on this player so it also goes away upon disconnecting.
Thanks!
Thanks!
0
Comments
-
Hi @rokugatsu,
sinceOnDisconnectedFromPhoton()
is also called on regular Disconnects you should take a look atOnConnectionFail(DisconnectCause cause)
which is called when something causes the connection to fail after it was established. To 'enable'PhotonNetwork.ReconnectAndRejoin();
you have to set up the room properly when creating it. Therefore you can use the RoomOptions to set values for PlayerTtl and EmptyRoomTtl. This might look like this:RoomOptions options = new RoomOptions { PlayerTtl = 60000, // 60 seconds EmptyRoomTtl = 60000 // 60 seconds };
Don't forget to apply those options when creating the room.1 -
Awesome @Christian_Simon , will try this one thanks a lot!0