How to Rejoin a player to a room using PUN Unity3D?

人走茶凉 提交于 2019-12-25 08:48:15

问题


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.



来源:https://stackoverflow.com/questions/34991844/how-to-rejoin-a-player-to-a-room-using-pun-unity3d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!