Пример #1
0
        /// <summary>
        /// If a lighting scene is being used, this ensures that at least one lighting scene is loaded in editor.
        /// </summary>
        private void EditorUpdateLightingScene(bool heirarchyDirty)
        {
            if (!profile.UseLightingScene || !profile.EditorManageLoadedScenes)
            {
                return;
            }

            if (string.IsNullOrEmpty(ActiveLightingScene))
            {
                ActiveLightingScene = profile.DefaultLightingScene.Name;
            }
            else
            {
                foreach (SceneInfo lightingScene in profile.LightingScenes)
                {
                    if (lightingScene.Name == ActiveLightingScene)
                    {
                        Scene scene;
                        if (EditorSceneUtils.LoadScene(lightingScene, false, out scene))
                        {
                            EditorSceneUtils.CopyLightingSettingsToActiveScene(scene);

                            if (profile.EditorEnforceLightingSceneTypes && heirarchyDirty)
                            {
                                EditorEnforceLightingSceneTypes(scene);
                            }
                        }

                        if (profile.EditorEnforceSceneOrder)
                        {   // If we're enforcing scene order, make sure this scene comes after the current scene
                            Scene currentFirstScene = EditorSceneManager.GetSceneAt(0);
                            EditorSceneManager.MoveSceneAfter(scene, currentFirstScene);
                        }
                    }
                    else
                    {
                        EditorSceneUtils.UnloadScene(lightingScene, true);
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Singly loads next content scene (if available) and unloads all other content scenes.
        /// Useful for inspectors.
        /// </summary>
        public void EditorLoadNextContent(bool wrap = false)
        {
            string contentSceneName;

            if (contentTracker.GetNextContent(wrap, out contentSceneName))
            {
                foreach (SceneInfo contentScene in ContentScenes)
                {
                    if (contentScene.Name == contentSceneName)
                    {
                        EditorSceneUtils.LoadScene(contentScene, false, out Scene scene);
                    }
                    else
                    {
                        EditorSceneUtils.UnloadScene(contentScene, false);
                    }
                }
            }

            contentTracker.RefreshLoadedContent();
        }