Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

pun 1.80 - after calling Disconnect() the networkingPeer.State stays in Disconnecting indefinitley

$
0
0
My game is a multiplayer game, but have also a single player mode. After I upgraded to pun 1.80 I started to experience the following problem:

When a single player game is started this code is executed:
PhotonNetwork.Disconnect();
PhotonNetwork.offlineMode = true;
After the single player game finished (couple of minutes) and the player goes back to the main menu the PhotonNetwork.networkingPeer.State is still ClientState.Disconnecting, so I can't connect again!

trying to connect with this code:
PhotonNetwork.offlineMode = false;
PhotonNetwork.ConnectToRegion(CloudRegionCode.eu, "2.0");
does nothing and later I get errors when I try to join the lobby. Also PhotonNetwork.insideLobby is true!

If I use this code:
PhotonNetwork.Reconnect();
Then I get this error: Connect() failed. Can't connect while disconnecting (still). Current state: Disconnecting

Also it doesn't matter how long I wait, the status never changes from disconnecting to disconnected.
I am using now this workaround:
if(PhotonNetwork.networkingPeer.State == ClientState.Disconnecting)
PhotonNetwork.networkingPeer.StopThread();

PhotonNetwork.ConnectToRegion(CloudRegionCode.eu, "2.0");
Is there a better way to handle this?

Viewing all articles
Browse latest Browse all 8947

Trending Articles