OnConnectedToMaster() doesnt trigger
hey I am really new to Photon and i have following issue:
When I start my game and create a room everything works fine but as soon as i go back to the menu and try to create a new Room i get this Error:
"JoinOrCreateRoom failed. Client is on GameServer (must be Master Server for matchmaking)but not ready for operations (State: Leaving). Wait for callback: OnJoinedLobby or OnConnectedToMaster. "
I make sure that I leave the room before Menu gets Loaded. Can Anyone help me?
When I start my game and create a room everything works fine but as soon as i go back to the menu and try to create a new Room i get this Error:
"JoinOrCreateRoom failed. Client is on GameServer (must be Master Server for matchmaking)but not ready for operations (State: Leaving). Wait for callback: OnJoinedLobby or OnConnectedToMaster. "
I make sure that I leave the room before Menu gets Loaded. Can Anyone help me?
0
Comments
-
i tried but it ended up never going to the menu.
Thats my code for going back:public void clickHomeButton() { StartCoroutine("disconnectRoom"); } IEnumerator disconnectRoom() { PhotonNetwork.LeaveRoom(); while (PhotonNetwork.InRoom) yield return null; PhotonNetwork.LoadLevel(2); }
0 -
assuming you extend MonoBehaviourPunCallbacks:
public void clickHomeButton() { if (!PhotonNetwork.LeaveRoom()) { Debug.LogError("Leaving room failed"); } } public void override OnLeftRoom() { PhotonNetwork.LoadLevel(2); } public void override OnConnectedToMaster() { }
0 -
thank you for your reply!!!
I tried your code and got this error :
"Operation LeaveRoom (254) not called because client is not connected or not ready yet, client state: Leaving"
really dont understand why ;/0 -
i just tried to see if i am connected when i click button with debug.log(PhotonNetwork.IsConnected) and it returns true0
-
also just found out that it works with only one person in the room but not if 2 person are in the room0
-
okay finally figured it out!!! thanks !!!0