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

  • Tobias
    Tobias admin
    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.
  • lxg
    lxg
    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.