// 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) { ShowRegistrationWizard(); PhotonNetwork.PhotonServerSettings.DisableAutoOpenWizard = true; PhotonEditor.SaveSettings(); } // Workaround for TCP crash. Plus this surpresses any other recompile errors. if (EditorApplication.isCompiling) { if (PhotonNetwork.IsConnected) { if (lastWarning > EditorApplication.timeSinceStartup - 3) { // Prevent error spam Debug.LogWarning(CurrentLang.WarningPhotonDisconnect); lastWarning = EditorApplication.timeSinceStartup; } PhotonNetwork.Disconnect(); } } }
// 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 OnProjectChanged() { // Prevent issues with Unity Cloud Builds where ServerSettings are not found. // Also, within the context of a Unity Cloud Build, ServerSettings is already present anyway. #if UNITY_CLOUD_BUILD return; #endif PunSceneSettings.SanitizeSettings(); if (PhotonNetwork.PhotonServerSettings == null) { PhotonNetwork.CreateSettings(); if (PhotonNetwork.PhotonServerSettings == null) { Debug.LogError("CreateSettings() failed to create PhotonServerSettings."); 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) { ShowRegistrationWizard(); PhotonNetwork.PhotonServerSettings.DisableAutoOpenWizard = true; PhotonEditor.SaveSettings(); } }
// 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 OnProjectChanged() { if (PhotonNetwork.PhotonServerSettings == null) { PhotonNetwork.CreateSettings(); if (PhotonNetwork.PhotonServerSettings == null) { Debug.LogError("CreateSettings() failed to create PhotonServerSettings."); 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) { ShowRegistrationWizard(); PhotonNetwork.PhotonServerSettings.DisableAutoOpenWizard = true; PhotonEditor.SaveSettings(); } }