예제 #1
0
        /// <summary>
        /// Ensures that there are no scenes in build settings with duplicate names.
        /// If any are found, a resolve duplicates window is launched.
        /// </summary>
        private void EditorCheckForSceneNameDuplicates()
        {
            List <SceneInfo> allScenes = new List <SceneInfo>();
            Dictionary <string, List <int> > duplicates = new Dictionary <string, List <int> >();

            foreach (SceneInfo sceneInfo in profile.LightingScenes)
            {
                if (!sceneInfo.IsEmpty)
                {   // Don't bother with empty scenes, they'll be handled elsewhere.
                    allScenes.Add(sceneInfo);
                }
            }

            foreach (SceneInfo sceneInfo in profile.ContentScenes)
            {
                if (!sceneInfo.IsEmpty)
                {   // Don't bother with empty scenes, they'll be handled elsewhere.
                    allScenes.Add(sceneInfo);
                }
            }

            if (profile.UseManagerScene && !profile.ManagerScene.IsEmpty)
            {
                allScenes.Add(profile.ManagerScene);
            }

            if (EditorSceneUtils.CheckBuildSettingsForDuplicates(allScenes, duplicates))
            {
                // If it's already open, don't display
                if (!ResolveDuplicateScenesWindow.IsOpen)
                {
                    ResolveDuplicateScenesWindow window = EditorWindow.GetWindow <ResolveDuplicateScenesWindow>("Fix Duplicate Scene Names");
                    window.ResolveDuplicates(duplicates, allScenes);
                }
            }
            else if (ResolveDuplicateScenesWindow.IsOpen)
            {
                // If we fixed the issue without the window, close the window
                ResolveDuplicateScenesWindow.Instance.Close();
            }
        }
예제 #2
0
 private void OnDisable()
 {
     instance = null;
 }
예제 #3
0
 private void OnEnable()
 {
     instance = this;
 }