Unity Problems with Photon Connection Problems

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Unity Problems with Photon Connection Problems

Jolykj
2021-08-17 12:59:47

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
2022-01-05 21:00:05

Same Problem

Lwt168
2022-12-28 04:06:08

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.

Back to top