// called in editor, opens wizard for initial setup, keeps scene PhotonViews up to date and closes connections when compiling (to avoid issues) private static void EditorUpdate() { if (PhotonNetwork.PhotonServerSettings == null) { PhotonNetwork.CreateSettings(); } if (PhotonNetwork.PhotonServerSettings == null) { return; } // serverSetting is null when the file gets deleted. otherwise, the wizard should only run once and only if hosting option is not (yet) set if (!PhotonNetwork.PhotonServerSettings.DisableAutoOpenWizard && PhotonNetwork.PhotonServerSettings.HostType == ServerSettings.HostingOption.NotSet) { ShowRegistrationWizard(); PhotonNetwork.PhotonServerSettings.DisableAutoOpenWizard = true; PhotonEditor.SaveSettings(); } // Workaround for TCP crash. Plus this surpresses any other recompile errors. if (EditorApplication.isCompiling) { if (PhotonNetwork.connected) { if (lastWarning > EditorApplication.timeSinceStartup - 3) { // Prevent error spam UnityEngine.Debug.LogWarning(CurrentLang.WarningPhotonDisconnect); lastWarning = EditorApplication.timeSinceStartup; } PhotonNetwork.Disconnect(); } } }
/// <summary> /// Fill out App-specific IDs. /// </summary> public static void FillAppID() { string appId = File.ReadAllText(_FindKeystoreDirectory() + "/pun-app-id.txt"); if (PhotonNetwork.PhotonServerSettings == null) { PhotonNetwork.CreateSettings(); } if (PhotonNetwork.PhotonServerSettings == null) { return; } PhotonNetwork.PhotonServerSettings.AppID = appId; EditorUtility.SetDirty(PhotonNetwork.PhotonServerSettings); }
public static void BuildAll() { string appId = File.ReadAllText(BuildUtil.FindKeystoreDirectory() + "/pun-app-id.txt"); if (PhotonNetwork.PhotonServerSettings == null) { PhotonNetwork.CreateSettings(); } if (PhotonNetwork.PhotonServerSettings == null) { return; } PhotonNetwork.PhotonServerSettings.AppID = appId; BuildUtil.BuildAPK(multiplayerAPK); PhotonNetwork.PhotonServerSettings.AppID = string.Empty; }