JoinRandomRoom failed. Client is on GameServer (must be Master Server for matchmaking) and ready

As in the title, I cannot connect to a master server and I don't know why.

here is the code that I use to connect : https://gitlab.com/studiobaguette/cube_project/blob/fc85686cdf79a124acd0311a3512fe05855b02d7/SpaceCubev1.2/Assets/Scripts/Network/MatchMakingSystem.cs

Basically, we are using a numpad to enter a code and create a room with this code... this was working with Photon classic but since we have updated to photon 2 it's broken..

can someone help me ? thanks :smile:

Comments

  • Hi @ascure,

    Thank you for choosing Photon!

    As in the title, I cannot connect to a master server and I don't know why.
    The title does not say that you cannot connect to master server, it states that you are calling JoinRandomRoom while connected to game server and probably inside/joined to a room.

    We can't access your private GitLab repository.

    Just paste the whole stacktrace of the error message AND the code snippet of the method where you call JoinRandomRoom.
  • Ok I found out what was going on ... If you have the same problem , check if you implemented the callbacks correctly ...
  • I've tried watching 4-5 tutorials and still having this same error. I've also implemented all callbacks correctly too. Please help me out.
  • JohnTube
    JohnTube mod
    edited April 2021
    Hi @ALIENPANDA,

    Thank you for choosing Photon!

    You are either calling JoinRandomRoom while you are still in a room or while in the process of joining or leaving one.

    You could try adding a check before calling JoinRandomRoom:
    Example:
    if (PhotonNetwork.NetworkClientState == ClientState.ConnectedToMasterServer)
    {
        PhotonNetwork.JoinRandomRoom();
    }
    else
    {
       Debug.LogError("Can't join random room now, client is not ready");
    }
    
  • I have the same error but I did not do a random room this is the error I am getting Debug.LogError("CreateRoom failed. Client is on " + NetworkingClient.Server + " (must be Master Server for matchmaking)" + (IsConnectedAndReady ? " and ready" : "but not ready for operations (State: " + NetworkingClient.State + ")") + ". Wait for callback: OnJoinedLobby or OnConnectedToMaster.");

            return false;