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

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

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

lxg
2021-06-07 07:50:18

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
2021-06-07 10:28:36

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
2021-06-07 12:38:34

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.

Toxic_Nuggs
2021-10-13 22:45:49

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.

Tobias
2021-10-14 11:37:08

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

Kshitijv24
2022-04-19 06:11:34

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.

flawlesstroy
2022-06-05 18:43:52

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

Anakin
2022-07-01 02:46:55

Tobias 2021-06-07T10:28:36+00:00
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. Can you explain and show how to do this in code?

Anakin
2022-07-01 02:56:19

Kshitijv24 2022-04-19T06:11:34+00:00

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.

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.

Yepnoob
2022-07-12 09:03:45

Try using LeaveRoom() when ending a game session

SmolGameDev99
2022-09-30 02:32:46

flawlesstroyyour solution works for me! Ty so much!

Back to top