CreateRoom failed. Client is on GameServer(must be master server for matchmaking) and ready. Wait fo

Hello, I'm realllly stuck on an issue.

My multiplayer was working fine then i upgraded to pun2 and now when i connect I get this error:

CreateRoom failed. Client is on GameServer(must be master server for matchmaking) and ready. Wait for callback: OnJoinedLobby or OnConnectedToMaster.

I am quite sure my script is fine:

//establishing connections here:

private void Awake()
{
PhotonNetwork.ConnectUsingSettings();
}

public override void OnConnectedToMaster() // callback function for when first connection is made
{
PhotonNetwork.JoinLobby(TypedLobby.Default);
//PhotonNetwork.AutomaticallySyncScene = true;
Debug.Log("Connected");
}

//Creating room here after a button click:

PhotonNetwork.CreateRoom(CreateGameInput.text, new RoomOptions() { MaxPlayers = 4 });

Can anyone help? I've read everything i can find on this. Most posts say that there is no connection but I confirmed connection using debug in the OnConnectedToMaster function as shown above...

Thank you

Comments

  • The background is: There are 3 server types: Name Server, Master Server and Game Server. The Master Server is for matchmaking and the Game Server only runs rooms. It only knows a Master Server it reports to.

    So, when you are in a room, you can't do matchmaking. If you called JoinRoom or CreateRoom on a Master Server, the client will switch machines and calling CreateRoom again, will cause this.

    Leave the room, wait for the OnConnectedToMasterServer callback and you can do matchmaking again.
  • Thanks. I was able to resolve it.

    Turns out the problem wasn't the connection or the room creation. the OnJoined function needed to be a public override and I had it as private. it worked like that on pun but apparently not pun 2. the error was pretty misleading.

    If anyone comes across this and you know your connection is fine, please check what happens n your script AFTER the room is created. Seems this error can be thrown when it tries to join a room but the scene doesn't change.
  • How do I know if im in a room because i keep getting this error no matter what I do

    CreateRoom failed. Client is on MasterServer (must be Master Server for matchmaking)but not ready for operations (State: PeerCreated). Wait for callback: OnJoinedLobby or OnConnectedToMaster.

  • I would recommend reading and coding-along the Basics Tutorial. It should show in-context how you'd join rooms, etc.

  • I solve this problem by opening a proton engine website dashboard tab in the browser and then trying to connect with the server and it's worked in my case.

  • For me the issue was because the default scene is Lobby when you load in, you need to switch to the Loading scene before you load so it can properly connect to Lobby

  • Can you put what your script is because I'm having the same issue but my dashboard is connected and I'm sure my script is fine.

  • Try using LeaveRoom() when ending a game session

  • flawlesstroy your solution works for me! Ty so much!