Disconnecting from Photon?
Hi,
I created Room and entered into it. Pressing back button should disconnect. But, still its in Connection.
So, I can't able to create room again.
Here is my scenario in Workers Demo example:
First I created an Room and waiting for someone to enters into the room.
After one client entered into my room. I give Return to lobby to come into Menu (Create or Join Group)
From there if i again try create room. It shows an error like below.
I know that its not yet disconnected.
Can you tell me how to disconnect when i press back button from InGame.? :?:
createGame failed, client stays on masterserver: OperationResponse 227: ReturnCode: 32766 (A game with the specified id already exist.). Parameters: {}.
UnityEngine.Debug:LogError(Object)
PhotonHandler:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:170)
NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:802)
NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:952)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:76)
I created Room and entered into it. Pressing back button should disconnect. But, still its in Connection.
So, I can't able to create room again.
Here is my scenario in Workers Demo example:
First I created an Room and waiting for someone to enters into the room.
After one client entered into my room. I give Return to lobby to come into Menu (Create or Join Group)
From there if i again try create room. It shows an error like below.
I know that its not yet disconnected.
Can you tell me how to disconnect when i press back button from InGame.? :?:
createGame failed, client stays on masterserver: OperationResponse 227: ReturnCode: 32766 (A game with the specified id already exist.). Parameters: {}.
UnityEngine.Debug:LogError(Object)
PhotonHandler:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:170)
NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:802)
NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:952)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:76)
0
Comments
-
You can use PhotonNetworking.Leave() to not disconnect but leave the room.
Or you can use PhotonNetworking.Disconnect(), which will require a PhotonNetwork.ConnectUsingSettings() again.1 -
I disconnected from the room and PhotonNetwork successfully.
public void OnPhotonPlayerDisconnected(PhotonPlayer player) function will be called after player disconnected/leave from Room.
But, In My scenario After one player is disconnecs/leaves the room means the list need to updated. I will call one function which refreshes
playerlist. But it contains RPC Functions. So, I can't able to call inside OnPhotonPlayerDisconnected()[Calling inside the
OnPhotonPlayerDisconnected will leads to crash Unity].
Where could i call to refresh to playerlist. So, that others can know how many players are active/available.0 -
Which player list? Photon Unity Networking has a built-in player list but that is of course kept up to date for you. You don't have to manipulate that one.
If you built your own, I can't really help, cause I don't know the code and what you do.
In worst case, make sure the next Update() loop will call some method to clean your player list.0