Unity Problems with Photon Connection Problems

Options
When i try to "play" the game an error message with yellow pops up saying:
"PUN is in development mode (development build). As the 'dev region' is not empty (eu) it overrides the found best region. See PhotonServerSettings.

UnityEngine.Debug:LogWarning (object)"



I know from tutorials that i should get a message saying: "Received your UserID from server. Updating local value to: [Number]"

But i don't get that message...

What have i not done correctly? why don't i get the connection log?


using UnityEngine;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine.UI;


public class NetworkScript : MonoBehaviourPunCallbacks
{
public static NetworkScript lobby;
public Button joinPlay;
public Button cancelSearch;

// Start is called before the first frame update
private void Avake()
{
lobby = this;
}

void Start()
{
//PhotonNetwork.LeaveRoom();
//PhotonNetwork.LeaveLobby();
PhotonNetwork.Disconnect();
PhotonNetwork.ConnectUsingSettings();
}

void OnEnable()
{
//Register Button Events
joinPlay.onClick.AddListener(() => PlayGame());
cancelSearch.onClick.AddListener(() => CancelGame());

}

public void PlayGame()
{
PhotonNetwork.JoinRandomRoom();
}

public override void OnJoinRandomFailed(short returnCode, string message)
{
Debug.Log("Tried to join and failed");
CreateRoom();
}

void CreateRoom()
{
int randomRoomName = Random.Range(0, 10000);
RoomOptions roomOps = new RoomOptions() { IsVisible = true, IsOpen = true, MaxPlayers = 12 };
PhotonNetwork.CreateRoom("Room" + randomRoomName, roomOps);
Debug.Log("Room Created :) ");
}

public override void OnJoinedRoom()
{
Debug.Log("Room had been joined");
}

public override void OnCreateRoomFailed(short returnCode, string message)
{
Debug.Log("Tried to make a room, makes a new one.");
CreateRoom();
}

public override void OnConnectedToMaster()
{
Debug.Log("Player has connected to the Photon master server");
}

void CancelGame()
{
PhotonNetwork.LeaveRoom();
}

public void OnFailedToConnectToPhoton()
{
Debug.Log("doens't connect to server...");
}
}

Comments

  • Toad1g
    Options

    Same Problem

  • Lwt168
    Options

    This is a harmless warning.

    you can find a ScriptObject file in your project as this path:

    Assets/Photon/PhotonUnityNetworking/Resources/PhotonServerSettings.asset

    This is the setting for photon, the "Dev region" will has a default value which is "eu" for your region. You can delete the field to make it empty, so that photon will choose the server base on network speed.