// 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() { PhotonEditorUtils.ProjectChangedWasCalled = true; // 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 if (PhotonNetwork.PhotonServerSettings == null || PhotonNetwork.PhotonServerSettings.AppSettings == null || string.IsNullOrEmpty(PhotonNetwork.PhotonServerSettings.AppSettings.AppIdRealtime)) { PhotonNetwork.LoadOrCreateSettings(true); } if (PhotonNetwork.PhotonServerSettings == null) { // the PhotonServerSettings are loaded or created. If both fails, the Editor should probably not run (anymore). return; } PunSceneSettings.SanitizeSceneSettings(); // 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(); } }