ConnectUsingSettings() works, but ConnectToRegion() does not. (Error ReturnCode 32767)

Options
I've been using PhotonNetwork.ConnectUsingSettings() until recently because I want people from different regions to be able to play with each other. I taker the region from a drop down list, then use that to connect. When I hit the connect button in game I connect just fine if I'm using ConnectUsingSettings(), but if I use ConnectToRegion I get the following error log:
OperationResponse 230: ReturnCode: 32767 (Invalid application id). Parameters: {} Server: NameServer Address: ns.exitgames.com:5058
UnityEngine.Debug:LogError(Object)
Photon.Realtime.LoadBalancingClient:DebugReturn(DebugLevel, String) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:1835)
Photon.Realtime.LoadBalancingClient:OnOperationResponse(OperationResponse) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:1909)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(StreamBuffer) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PeerBase.cs:616)
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:545)
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1473)
Photon.Pun.PhotonHandler:FixedUpdate() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:130)

Here's my code:
//take region from region dropdown list
string region = "us";
switch (regionList.value)
{
case 0: region = "asia"; break;
case 1: region = "au"; break;
case 2: region = "cae"; break;
case 3: region = "eu"; break;
case 4: region = "in"; break;
case 5: region = "ja"; break;
case 6: region = "ru"; break;
case 7: region = "sa"; break;
case 8: region = "kr"; break;
case 9: region = "us"; break;
case 10: region = "usw"; break;
}
PlayerPrefs.SetInt("Region", regionList.value);
PhotonNetwork.ConnectToRegion(region);

Comments

  • Tobias
    Options
    You seem to be using PUN 2.
    ConnectToRegion() does NOT use the PhotonServerSettings, so you have to set the AppId before you connect.
    It's typically simpler to change the region in the PhotonServerSettings and then still use ConnectUsingSettings(), which is the only method that actually uses the settings.
  • Wschmidth
    Options
    @Tobias Thanks, after changing PhotonNetwork.PhotonServerSettings.AppSettings.FixedRegion then connecting using PhotonNetwork.ConnectUsingSettings(), it worked perfectly.