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! Your search result can be found below. Plus, we offer support via 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.

PhotonNetwork.ConnectToRegion not working

purple_goo
2019-05-18 20:03:49

I have a project in Unity, and I'd like to make sure even distant users can be in the same room so I wanted to limit to a single region ("us"). I am starting from code that is very similar to the sample.

So, based on what I saw in the documentation [1], I replaced

PhotonNetwork.ConnectUsingSettings();

with

PhotonNetwork.ConnectToRegion("us")

I was expecting my application would work the same, just always connect to the US region. Instead, it stopped working. What happens when I call ConnectToRegion is I see an error in the log ([2], below), and then I get the disconnect callback.

I have been able to work around this issue by restricting the whitelist to just the "us" region in the Photon web dashboard, but in the future I'd like to allow players to select their region.

How do I allow players to select their region?

Thank you in advance.

[1] https://doc.photonengine.com/en-us/pun/current/connection-and-authentication/regions

[2]
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:2010)
Photon.Realtime.LoadBalancingClient:OnOperationResponse(OperationResponse) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2084)
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:550)
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:116)

Comments

JohnTube
2019-05-20 13:16:29

Hi @purple_goo,

Thank you for choosing Photon!

This was already asked before, try searching the forum, example discussions:

https://forum.photonengine.com/discussion/comment/42730/#Comment_42730
https://forum.photonengine.com/discussion/comment/44858/#Comment_44858
https://forum.photonengine.com/discussion/comment/44829/#Comment_44829

purple_goo
2019-05-21 03:47:28

Thank you so much, @JohnTube! That did the trick. I had searched but clearly not well enough.

Back to top