Disconnected after change the scene, but DisconnectCause is just None.
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Disconnected after change the scene, but DisconnectCause is just None.
modernator
2021-07-02 15:10:19
When the game is over, all clients back to the previous scene.
However, when the scene is loaded, all clients instantly disconnected immediately without any reason.
Before I updated PUN 2 to the latest version, the DisconnectCause was DisconnectByClientLogic, but after the update, DisconnectCause changed to None.
I don't think it's an intended feature, what causes the disconnection? I want to keep players stay in the same room so that they can play right after the previous game is done.
Using Unity 2019.4.3f1 and PUN 2.33 lib 4.1.6.3, updated yesterday.
Comments
modernator
2021-07-03 09:38:55
It's been 4 days since I struggling with this issue, anybody help?
I changed my code to synchronize the scene from RaiseEvent to using "PhotonNetwork.AutomaticallySyncScene = true;" instead, now I got this error message has shown up in my console:
Operation SetProperties (252) not called because client is not connected or not ready yet, client state: Disconnecting
UnityEngine.Debug:LogError(Object)
Photon.Realtime.LoadBalancingClient:DebugReturn(DebugLevel, String) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2552)
Photon.Realtime.LoadBalancingClient:CheckIfOpCanBeSent(Byte, ServerConnection, String) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2481)
Photon.Realtime.LoadBalancingClient:OpSetPropertiesOfRoom(Hashtable, Hashtable, WebFlags) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2134)
Photon.Realtime.Room:SetCustomProperties(Hashtable, Hashtable, WebFlags) (at Assets/Photon/PhotonRealtime/Code/Room.cs:430)
Photon.Pun.PhotonNetwork:SetLevelInPropsIfSynced(Object) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:2177)
Photon.Pun.PhotonNetwork:NewSceneLoaded() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1474)
Photon.Pun.<>c:<Start>b__13_0(Scene, LoadSceneMode) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:126)
UnityEngine.SceneManagement.SceneManager:Internal_SceneLoaded(Scene, LoadSceneMode)
There is no code for leaving the room in my scripts, and I put the Debug.Log every line of code where it calls PhotonNetwork.Disconnect() and there was none of them invoked from my code.
Seriously, just tell me if it's an intended feature, then I'll change the workflow to something different. Otherwise, what causes the force disconnection?
modernator
2021-07-05 02:22:58
Anyone?
PUN does not disconnect clients when you load scenes. There is a thread keeping connections up for a while, if Unity doesn't call Update (and related methods) while loading.
Still you may be running into a disconnect (timeout or due to flooding the server's receive and send buffers).
Do you send a lot when you switch scenes?
There is a Master Server for matchmaking and several Game Servers for actual game play. When you leave a room, this triggers switching servers under the hood.
This is why you should wait for the callback OnConnectedToMaster after calling LeaveRoom.
In your case, it seems that some script in the new scene sets a property for the room but your client no longer is in any.
You could enable the SupportLogger (in PhotonServerSettings) and send us the log to: [email protected]
Back to top