How to get list Region which player online joined?
Options
Hi.I'm having a problems.If 2 player with 2 different region then they can't connect with together.I'm using JoinRandomRoom.My solution when player connect to region which don't have any player online joined then I want switch that player to region exits(which other player created).Now I want to know all region that player joined.or which have other solution? Sorry my English.Thanks.
0
Comments
-
I use IConnectionCallbacks and override OnRegionListReceived(RegionHandler) but this method don't call.0
-
Hi @Amobear,
Make sure to register the callbacks implemented by callingPhotonNetwork.AddCallbackTarget(this)
.
Read ".Net Callbacks".
Or simply extendMonoBehaviourPunCallbacks
.
If you enable "SupportLogger" from PhotonServerSettings for debugging purposes, you can check ifOnRegionListReceived
is really called or not.
If you have a "Fixed Region" in PhotonServerSettings, the callback will not be triggered as the client will try to connect to that specific fixed region instead of fetching the list of available regions from the server. If you do not callConnectUsingSettings
, the callback may not be triggered.0 -
I created a class:
public class RegionMode : MonoBehaviourPunCallbacks { // Use this for initialization void Start() { PhotonNetwork.ConnectUsingSettings(); } public override void OnRegionListReceived(RegionHandler regionHandler) { base.OnRegionListReceived(regionHandler); Debug.Log("REGION " + regionHandler.EnabledRegions.ToString()); } }
and attack it to scene but this method still don't call.Where am I wrong? Thanks.0 -
Thanks @JohnTube .I remove fixed region in photonserversetting.Right now i'ts showed all list region.But Which I really want to know.Assuming when I connect to best region is "asia" but don't have anyone in "asia" server.Asssuming having other player in "eu" server.Which I need when I check don't have anyone same my server and then I find server that player joined and switch to that server.thanks.0