r/UnityHelp • • Aug 17 '21

PROGRAMMING Unity Problems with Photon

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...

So beside this error i am unsure if it is best to use Photon Pun or another service, for a multiplayer 12 player game :)

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...");

}

}

3 Upvotes

7 comments sorted by

1

u/mrventures Aug 18 '21

Windows-->Photon-->Highlight Window

is where you'll find the server settings they're chatting about

1

u/Qulddell Aug 19 '21

So i did found a place where i did need to put in a "0", but it still don't connect to the server or is very slow.

Here is what happen just as i open the scene with he scripts in. No log of connection verification.

https://imgur.com/eNH8J23

And when i press a Join button to join a room.

https://imgur.com/DfOA0u8

1

u/siddharth3322 Dec 17 '21

u/Qulddell Today I was facing the same issue any solution you found for this problem?

1

u/FirGue Sep 16 '23

And today I was facing the same, issue so how did you solve it ???

1

u/Suspicious_Diet_9239 May 26 '24

You delte the value in the Dev Region on the PhotonServerSetting object

1

u/ScottyV_ Mar 09 '25

Thanks! This solved the issue. You need to click on the Console, then click the error message. Then on the right hand side of Unity you'll see DevRegion. Just delete whatever value is in there (mine was "jp")