How to Rejoin a player to a room using PUN Unity3D

2019-09-13 03:35发布

问题:

I am building a multiplayer game using PUN where two player in a room will play with each other. While playing if network seems very slow of a player, he/she automatically disconnected from Photon server. I want to give a waiting time to respond the disconnected player and meanwhile he can again join the room and continue his game.

How can I do this? Any kind of help is highly appreciated. TIA

回答1:

PUN does not support rejoin as Phtoon Turnbased does (with actor number and player state preserved). So you need to handle disconnection event and reconnect again as a new player and update this player state with the state of disconnected player (that may be tricky sometimes). You may find easier to store all state in room properties and reference players there via name or userId.