CreateRoom failed. Client is on MasterServer

The Title explains the error. I tried everything and nothing worked, can someone please help me? Here is the code if needed

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

public class ConnectAndJoinRooms : MonoBehaviourPunCallbacks
{
public InputField CreateInput;
public InputField joinInput;

public void CreateRoom()
{
PhotonNetwork.CreateRoom(CreateInput.text);
}

public void JoinRoom()
{
PhotonNetwork.JoinRoom(joinInput.text);
}

public override void OnJoinedLobby()
{
PhotonNetwork.LoadLevel("Game");

}
}

Comments

  • The error usually comes with an error message and a code. Let us know those.
    Also: Do you use the Photon Cloud?
  • I dont use Photon Cloud. Do I have to use it? Also here is the full error message : 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.
    UnityEngine.Debug:LogError (object)
    Photon.Pun.PhotonNetwork:CreateRoom (string,Photon.Realtime.RoomOptions,Photon.Realtime.TypedLobby,string[]) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:1764)
    CreateAndJoinRooms:CreateRoom () (at Assets/CreateAndJoinRooms.cs:15)
    UnityEngine.EventSystems.EventSystem:Update () (at Library/PackageCache/[email protected]/Runtime/EventSystem/EventSystem.cs:377)
  • First try to connect to Photon server , when connection is successful then try to create the room.
    public class ConnectAndJoinRooms : MonoBehaviourPunCallbacks
    {
    public InputField CreateInput;
    public InputField joinInput;
    
    public void Connect()
    {
    PhotonNetwork.ConnectUsingSettings();
    }
    public void CreateRoom()
    {
    PhotonNetwork.CreateRoom(CreateInput.text);
    }
    
     public override void OnConnectedToMaster()
    {
    CreateRoom();
    }
    
    public void JoinRoom()
    {
    PhotonNetwork.JoinRoom(joinInput.text);
    }
    
    public override void OnJoinedRoom()
    {
    PhotonNetwork.LoadLevel("Game");
    
    }
    }
    
  • I also got the same error . I got the code from tutorial By (Blackthronprod).