Exemplo n.º 1
0
        // 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();
            }
        }
Exemplo n.º 2
0
        // 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()
        {
            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();
            }
        }