Home > OS >  I got the error JoinRandomRoom failed. And I don't understand what the problem is because every
I got the error JoinRandomRoom failed. And I don't understand what the problem is because every

Time:10-26

I'm Connected To Master, the server is created and the game is the same version. Here is my error "JoinRandomRoom failed. Client is on MasterServer (must be Master Server for matchmaking) but not ready for operations (State: Joining). Wait for callback: OnJoinedLobby or OnConnectedToMaster. UnityEngine.Debug:LogError (object) Photon.Pun.PhotonNetwork:JoinRandomRoom (ExitGames.Client.Photon.Hashtable,byte,Photon.Realtime.MatchmakingMode,Photon.Realtime.TypedLobby,string,string[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:1663) Photon.Pun.PhotonNetwork:JoinRandomRoom () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:1597) join:JoinRoom () (at Assets/Scripts/join.cs:27) UnityEngine.EventSystems.EventSystem:Update () (at Library/PackageCache/[email protected]/Runtime/EventSystem/EventSystem.cs:385)"

here is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using UnityEngine.UI;

public class join : MonoBehaviourPunCallbacks
{
     public Text LogText;
private void Start()
    {
        PhotonNetwork.NickName = "Player"   Random.Range(1000, 9999);
        Log("Player`s name is set to"   PhotonNetwork.NickName);
        //try to connect
        PhotonNetwork.ConnectUsingSettings();
    }
    public override void OnConnectedToMaster()
    {
       Log("conected to master");
    }
    public void CreateRoom()
    {
        PhotonNetwork.CreateRoom(null, new Photon.Realtime.RoomOptions());
    }
    public void JoinRoom()
    {
        PhotonNetwork.JoinRandomRoom();
    }
    public override void OnJoinedRoom()
    {
        PhotonNetwork.LoadLevel("SampleScene");
    }
    private void Log(string message)
    {
        Debug.Log(message);
        LogText.text   = "\n";
        LogText.text   = message;
    }
}

CodePudding user response:

Hey a similiar discussion can be found here: https://forum.photonengine.com/discussion/16950/joinroom-failed-client-is-on-masterserver-but-not-ready-for-operations

Let me know if it helped

  • Related