Handling DisconnectCause.None
Hello,
I have a disconnect handler that attempts reconnection. It does this for the cases of DisconnectCause.ClientTimeout & DisconnectCause.ServerTimeout currently and everything works fine.
On the occasion that DisconnectCause.None, LeftRoomCleanUp() is not being called and therefore neither is LocalCleanupAnythingInstantiated() meaning the instantiated objects are not being deleted. I force this call myself upon disconnect and it seems to work.
My problem is that the player doesn't seem to have been removed from the room upon disconnection. How can I force this? How can I make sure I properly leave the room when I disconnect?
This is the error I get:
(Code 32746): Join failed: UserId 'xxx' already joined the specified game (JoinMode=0)..
I am currently on Pun 2.16 Photon lib: 4.1.2.19. Has this been dealt with in a newer Photon version?
Answers
-
Not related: I would recommend an update to the latest PUN 2.
I think you already did this:
You need to set a PlayerTTL when creating rooms. Then, players who time out, will just become inactive first and are only removed from the room after that delay. A EmptyRoomTTL keeps the room around when nobody is active anymore.
Then:
You need to ReJoin a room as long as the client is still in the room. This avoids the error you get now. ReconnectAndRejoin is the best and fastest approach.
0