public static bool ConnectToBestCloudServer(string gameVersion) { if (PhotonServerSettings == null) { Debug.LogError("Can't connect: Loading settings failed. ServerSettings asset must be in any 'Resources' folder as: PhotonServerSettings"); return(false); } if (PhotonServerSettings.HostType == ServerSettings.HostingOption.OfflineMode) { return(ConnectUsingSettings(gameVersion)); } networkingPeer.IsInitialConnect = true; networkingPeer.SetApp(PhotonServerSettings.AppID, gameVersion); var bestRegionCodeInPreferences = PhotonHandler.BestRegionCodeInPreferences; if (bestRegionCodeInPreferences != CloudRegionCode.none) { Debug.Log("Best region found in PlayerPrefs. Connecting to: " + bestRegionCodeInPreferences); return(networkingPeer.ConnectToRegionMaster(bestRegionCodeInPreferences)); } return(networkingPeer.ConnectToNameServer()); }