/// <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(); } }
private void OnDisable() { instance = null; }
private void OnEnable() { instance = this; }