Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

ConnectToRegion() problem after latest update

$
0
0
Since I updated PUN+, OnReceivedRoomListUpdate() is no longer triggered after connecting with a second region. Here is the code I have been using for the last year in my game:

void LoadServerList() {
if (ConnectionStage == 0)
{
// clear the current server list (if any)
ServerList_full = new List<string>();
ServerList_name = new List<string>();

// connect to read EU rooms
PhotonNetwork.ConnectToRegion (CloudRegionCode.eu, Version);
}

if (ConnectionStage == 1) PhotonNetwork.ConnectToRegion (CloudRegionCode.us, Version); // read US rooms

if (ConnectionStage == 2)
{
// add the missing servers
for (int i = 0; i < ServerList_all.Length; i++)
{
if (!ServerList_name.Contains(ServerList_all[i]))
{
ServerList_name.Add (ServerList_all[i]);
ServerList_full.Add (GetFullServerName (ServerList_all[i], 0, maxPlayers));
}
}
ConnectionStage++;
}
}

void OnReceivedRoomListUpdate()
{
if (Joining) return;

foreach (RoomInfo game in PhotonNetwork.GetRoomList())
{
ServerList_name.Add (game.name);
ServerList_full.Add (GetFullServerName (game.name, game.playerCount, game.maxPlayers));
}
PhotonNetwork.Disconnect();
ConnectionStage ++;
LoadServerList();
}


So OnReceivedRoomListUpdate() is called after I connect first to the EU regon. Then when PhotonNetwork.ConnectToRegion (CloudRegionCode.us, Version) is executed, OnReveivedRoomListUpdate() is never fired.

PS: It does connect to the US region, because I can bypass the room list update and join a US based server. But again OnReceivedRoomListUpdate() is only triggered the first time now.

What is going wrong?

Viewing all articles
Browse latest Browse all 15755

Trending Articles