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

Offline to online JoinRandom fail

$
0
0
Hi,
I'm having a really weird bug. Just recently I changed the game flow to start offlineMode = true, and later offlineMode = false and connect.
I've searched around and did everything I can find.

1. Start game offlineMode = true. Spawn player
2. At some point, destroy the player in local, and have tried all (combination) of the following, in various order:
PhotonNetwork.LeaveRoom();
PhotonNetwork.Disconnect();
PhotonNetwork.offlineMode = false;
PhotonNetwork.networkingPeer.State = ClientState.Disconnected;
3. Then a button to call ConnectUsingSetting or ConnectToRegion(what it was originally).

4. In OnConnectedToMaster, I have a coroutine to debug a few things:
Debug.Log(PhotonNetwork.countOfRooms);
Debug.Log("Room list count: " + PhotonNetwork.GetRoomList().Length);
Debug.Log("InRoom: " + PhotonNetwork.inRoom);
Debug.Log("State: " + PhotonNetwork.connectionStateDetailed);
This is the weird part: countOfRooms is 1, while GetRoomList.Length is 0 (Another client is already online and joined room. The countOfRoom 1 is definitely that one, because it's 0 when there's no other client). Btw, inRoom is false, State: ConnectedToMaster

5. When JoinRandomRoom is called, it fails with message: No Match found. It seems it doesn't consider countOfRooms, instead only GetRoomList. Why are they not the same in the first place?

If I never set offlineMode and adjusted the flow to straight away connect, everything works as expected.
I've been on this problem for a few hours, don't know what else to do but ask here...

Cheers

Viewing all articles
Browse latest Browse all 8947

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>