I have unity editor 2022.3,15f1 and test build for photon pun 2.
Getting error " JoinRoom failed. Client is on GameServer (must be Master Server for matchmaking) and ready. Wait for callback: OnJoinedLobby or OnConnectedToMaster. "
I know some people would say Im telling it what server to connect to and im alredy in a game server that im alredy in a room. Yes but it always connects to the game server EVEN WITH CURENT SETTINGS.
I have never gotted to connect to the master server for room creation even with about 20 tutorials and diferent scripts even ones made by photon. I cannot get the game to connect to the master server EVER!!!
using UnityEngine;
using Photon.Pun;
using Photon.Realtime;
public class ConnectToPhotonNetwork : MonoBehaviourPunCallbacks
{
private bool isConnecting = false;
public GameObject screen1;
public GameObject loadingEffect;
public GameObject lobbyScreen;
private void Start()
{
// Set the log level for debugging (optional)
PhotonNetwork.LogLevel = PunLogLevel.Full;
}
public void ConnectToPhoton()
{
Invoke("DelayedConnectToPhoton", 2f);
}
// Method to be called when you want to connect to Photon Network
private void DelayedConnectToPhoton()
{
if (!PhotonNetwork.IsConnected && !isConnecting)
{
isConnecting = true;
loadingEffect.gameObject.SetActive(true);
// Connect to Photon Realtime
PhotonNetwork.NickName = MasterManager.GameSettings.NickName;
PhotonNetwork.GameVersion = MasterManager.GameSettings.GameVersion;
PhotonNetwork.ConnectUsingSettings();
}
screen1.gameObject.SetActive(true);
}
// Callback when connected to Photon server
public override void OnConnectedToMaster()
{
Debug.Log($"Connected to Photon Server in region {PhotonNetwork.CloudRegion}!");
isConnecting = false;
loadingEffect.gameObject.SetActive(false);
lobbyScreen.gameObject.SetActive(true);
print(PhotonNetwork.LocalPlayer.NickName);
PhotonNetwork.JoinLobby();
}
// Callback when failed to connect to Photon server
public override void OnDisconnected(DisconnectCause cause)
{
Debug.LogWarningFormat("Disconnected from Photon Server. Reason: {0}", cause);
isConnecting = false;
}
}
also video Imgur: The magic of the Internet