[PhotonCloud] Changing server location at runtime

I was wondering if there was a way to be able to change your server location at runtime (using unity UI 4.6)
I was having problems with massive delay times, had 2 clients running and there was a 1 second delay sending data between them.( for instance the muzzle flash would show on one client then 1 second later show on the next.) I played around with the settings and found that it was because I had it set to EU server location. I set it to AU (since I'm from new Zealand) and that delay was reduced to next to nothing). I realize that most people wont problem have this problem since there internet speeds are a lot faster then ours. but for the people in locations like mine a game with one set server location wont do. so after this long explanation is it possible to set/choose your server location at runtime.

thanks in advance.

PUN can ping all regions for a player and connect to the best. In the PhotonServerSettings file, you can set the hosting type to "Best Region" and connect as before.
You can also call PhotonNetwork.OverrideBestCloudServer(cloudRegionCode) to override the region before you connect.

Keep in mind that this "fragments" your user base. A client can only find games in the same region. Until there are many players, it might make sense to use less regions and hide the lag a bit better.

I Cant Use PhotonNetwork.OverrideBestCloudServer(), it Says it Doesn exist?

Cause this thread is from 2015 and the api changed since.
Have a look at BestRegionSummaryInPreferences instead for PUN 2.

1 Like