Photon Cloud provides you with global connectivity to allow low latency gaming all around the world.
Setup Regions In PUN
connects your client to the Master Server with the lowest ping.
Results from pinging all Photon Cloud Master servers are saved in PlayerPrefs.
OverrideBestCloudServer(CloudRegionCode region) to explicitly set another region as "best" one.
You can setup the region as part of editing the PhotonServerSettings asset.
Connecting to a region then becomes as easy as calling
For additional setup info using PUN please refer to the Initial Setup doc.
Photon Cloud has servers in several regions, distributed across multiple hosting centers over the world.
Each Photon Cloud region is identified by a "region token".
To pass the region token with the "Connect" method of your client, call
|Chinese Mainland (See Instructions)||Shanghai||cn|
|South America||Sao Paulo||sa|
|USA, West||San José||usw|
Dashboard Regions Filtering
You can filter the list of available Photon Cloud regions per application on the fly directly from the dashboard.
Go to the dashboard and then click "Manage" for a chosen application and then click "Edit". You will find an input field where you can enter the list of whitelisted regions as follows:
- the allowed list should be a string of region tokens seprated by semicolon. e.g. "eu;us".
- region tokens are case insensitive and are defined here.
- undefined or unrecognized region tokens will be ignored from the list.
- empty ("") or malformed string (e.g. ";;;") means empty list.
- empty list means all available regions are allowed.
Once you confirm and save, the operation
GetRegions will return only the filtered list of regions.
Thus clients should select from that list but it's fully possible clients connect to any available region explicitly.
Take into consideration that dashboard updates propagation can take up to 10 minutes.
Using The Chinese Mainland Region
The Photon NameServer has to be local to China, as the firewall might block the traffic otherwise. The Chinese Photon NameSever is "ns-cn.exitgames.com".
Connecting with clients from outside of China mainland will most likely not produce good results. Also, connecting from the Photon servers to servers outside of China mainland (e.g. for Custom Authentication, WebHooks, WebRPCs) might not be reliable.
Also for legal reasons, you need a separate build for China and we recommend to use a separate AppId with it. For example, use a compile condition (of your choice) to change the AppId and the Photon NameServer depending on the build.
Follow these instructions to make a special build for the Chinese market:
- Set the AppId to the application that has China region unlocked. If you want to use same project and have different builds you can do something like this:
- Open the "NetworkingPeer.cs" file and set the
CloudRegionFlagenums to add new "CN" (or "cn") region token as follows:
PhotonNetwork.ConnectToRegion(CloudRegionCode.cn, gameVersion)to connect to Chinese Mainland region.