private void makeDirtyScenes() { for (int i = 0; i < EditorSceneManager.sceneCount; i++) { EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetSceneAt(i)); } }
public void Refresh() { for (int i = 0; i < Files.Length; i++) { if (Files[i] == null) { Debug.Log("Removing missing file from editor."); ArrayExtensions.RemoveAt(ref Files, i); for (int j = 0; j < EditorSceneManager.sceneCount; j++) { Scene scene = EditorSceneManager.GetSceneAt(j); if (scene != EditorSceneManager.GetActiveScene()) { if (!System.Array.Find(Files, x => x != null && x.GetName() == scene.name)) { EditorSceneManager.CloseScene(scene, true); break; } } } i--; } } if (Data == null && Files.Length > 0) { LoadData(Files[0]); } }
private void LoadAdditionalScenes() { List <string> includedScenesOnPlay = autoCharacterLoading.autoLoadScenes; int sceneCount = EditorSceneManager.sceneCount; List <string> sceneNames = new List <string>(); for (int i = 0; i < sceneCount; i++) { if (EditorSceneManager.GetSceneAt(i).path.Contains(autoCharacterLoading.gameplaySceneFolderName)) { sceneNames.Add(EditorSceneManager.GetSceneAt(i).name); } else { return; } } for (int i = 0; i < includedScenesOnPlay.Count; i++) { if (!sceneNames.Contains(includedScenesOnPlay[i])) { EditorSceneManager.LoadScene(includedScenesOnPlay[i], LoadSceneMode.Additive); } } }
// Find all assets void OnWizardOtherButton() { List <ParticleEmitter> results = new List <ParticleEmitter>(); for (int i = 0; i < EditorSceneManager.sceneCount; i++) { Scene scene = EditorSceneManager.GetSceneAt(i); GameObject[] roots = scene.GetRootGameObjects(); foreach (GameObject root in roots) { ParticleEmitter[] emitters = root.GetComponentsInChildren <ParticleEmitter>(true); results.AddRange(emitters); } } components = results.ToArray(); string[] prefabGUIDs = AssetDatabase.FindAssets("t:ParticleEmitter"); prefabs = new ParticleEmitter[prefabGUIDs.Length]; for (int i = 0; i < prefabGUIDs.Length; i++) { prefabs[i] = AssetDatabase.LoadAssetAtPath <GameObject>(AssetDatabase.GUIDToAssetPath(prefabGUIDs[i])).GetComponent <ParticleEmitter>(); } UpgradeAll(); }
// Play mode change callback handles the scene load/reload. private static void OnPlayModeChanged() { if (!LoadMasterOnPlay) { return; } if (!EditorApplication.isPlaying && EditorApplication.isPlayingOrWillChangePlaymode) { // User pressed play -- persist the currently loaded scenes. string[] _scenes = new string[EditorSceneManager.loadedSceneCount]; for (int i = 0; i < EditorSceneManager.loadedSceneCount; i++) { _scenes[i] = EditorSceneManager.GetSceneAt(i).path; } LoadedScenes = _scenes; ActiveScene = EditorSceneManager.GetActiveScene().name; if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo()) { EditorSceneManager.OpenScene(MasterScene, OpenSceneMode.Single); } else { // User cancelled the save operation -- cancel play as well. EditorApplication.isPlaying = false; } } if (EditorApplication.isPlaying && !EditorApplication.isPlayingOrWillChangePlaymode) { // User pressed stop -- reload previous scene. EditorApplication.update += ReloadLastScene; } }
public static void LogLightingSpriteData() { for (int i = 0; i < EditorSceneManager.loadedSceneCount; i++) { Scene scene = EditorSceneManager.GetSceneAt(i); foreach (var root in scene.GetRootGameObjects()) { foreach (var node in TraverseTransformTree(root.transform)) { GameObject gameObject = node.gameObject; StaticEditorFlags flags = GameObjectUtility.GetStaticEditorFlags(gameObject); if ((flags & StaticEditorFlags.LightmapStatic) == 0) { continue; } SpriteRenderer spriteRenderer = node.GetComponent <SpriteRenderer>(); if (!spriteRenderer) { continue; } Debug.LogFormat("{2} Lightmap .Index = {0}; .ScaleOffset = {1}", spriteRenderer.lightmapIndex, spriteRenderer.lightmapScaleOffset, spriteRenderer.name); } } } }
private static IList <IValidationError> RestoreScenesAfterValidationCallback(Func <IList <IValidationError> > validationCallback) { string oldActiveScenePath = EditorSceneManager.GetActiveScene().path; string[] oldScenePaths = new string[EditorSceneManager.sceneCount]; for (int i = 0; i < EditorSceneManager.sceneCount; i++) { oldScenePaths[i] = EditorSceneManager.GetSceneAt(i).path; } IList <IValidationError> validationErrors = validationCallback.Invoke(); bool first = true; foreach (string scenePath in oldScenePaths) { if (string.IsNullOrEmpty(scenePath)) { continue; } Scene scene = EditorSceneManager.OpenScene(scenePath, first ? OpenSceneMode.Single : OpenSceneMode.Additive); if (scenePath == oldActiveScenePath) { EditorSceneManager.SetActiveScene(scene); } first = false; } return(validationErrors); }
static IEnumerable <Scene> GetAllScenes() { for (int i = 0; i < EditorSceneManager.sceneCount; i++) { yield return(EditorSceneManager.GetSceneAt(i)); } }
private List <SceneInfo> GetScenesInHierarchy() { int count = SceneManager.sceneCount; //必须使用SeceneManager 获取该数值,否则未保存的的Scene将不被计数 Scene[] scenes = new Scene[count]; for (int i = 0; i < count; i++) { scenes[i] = EditorSceneManager.GetSceneAt(i); } List <SceneInfo> result = scenes.Select(v => { var sceneInfo = new SceneInfo() { instanceID = this.sceneInstanceIDs[Array.IndexOf(scenes, v)], name = v.name, path = v.path, enabledInSettings = EditorBuildSettings.scenes .Where(scene => scene.enabled) .Select(scene => scene.path) .Contains(v.path), }; return(sceneInfo); }).ToList(); return(result); }
public static void FilterCurrentStageOrScene(Func <Transform, bool> func, List <Transform> results) { var stage = PrefabStageUtility.GetCurrentPrefabStage(); if (stage != null) { using (var scope = ListPoolScope <Transform> .Create()) { stage.prefabContentsRoot.GetComponentsInChildren(true, scope.list); FilterList(func, scope.list, results); } } else { var count = EditorSceneManager.loadedSceneCount; for (var i = 0; i < count; i++) { FilterScene(EditorSceneManager.GetSceneAt(i), func, results); } if (Application.isPlaying) { // DontDestroyOnLoad Scene var go = new GameObject(); go.hideFlags = HideFlags.HideAndDontSave; GameObject.DontDestroyOnLoad(go); FilterScene(go.scene, func, results); GameObject.DestroyImmediate(go); } } }
private static void OnPlayModeStateChanged(PlayModeStateChange change) { if (ValidationSettings.ValidateScenesBeforePlayMode && change == PlayModeStateChange.ExitingEditMode) { var validator = new SceneValidator(); bool hasErrors = false; for (int i = 0; i < EditorSceneManager.sceneCount; i++) { var scene = EditorSceneManager.GetSceneAt(i); if (scene.isLoaded) { var validationReport = validator.CreateValidationReport(scene); validationReport.LogErrors(); if (validationReport.HasErrors) { hasErrors = true; } } } // Abort entering play mode. if (hasErrors) { EditorApplication.isPlaying = false; var sceneView = SceneView.lastActiveSceneView; if (sceneView != null) { sceneView.ShowNotification(new UnityEngine.GUIContent("- Play Mode Validation Failed -\nSee the console window for details."), 3.0); } } } }
private void AssignSelf() { if (GUILayout.Button("Assign", EditorStyles.miniButton)) { List <GameObject> rootObjects = new List <GameObject>(); int sceneCount = EditorSceneManager.sceneCount; for (int i = 0; i < sceneCount; i++) { EditorSceneManager.GetSceneAt(i).GetRootGameObjects(rootObjects); foreach (GameObject rootObject in rootObjects) { foreach (MonoBehaviour behaviour in rootObject.GetComponentsInChildren <MonoBehaviour>(true)) { foreach (FieldInfo variable in behaviour.GetType().GetFields()) { if (variable.FieldType.IsInstanceOfType(_target)) { variable.SetValue(behaviour, _target); } } } } } EditorSceneManager.MarkAllScenesDirty(); EditorUtility.SetDirty(_target); } }
public static void FilterCurrentStageOrScene(Func <Transform, bool> func, List <Transform> results) { using (var scope = ListPoolScope <Transform> .Create()) { var stage = PrefabStageUtility.GetCurrentPrefabStage(); if (stage != null) { stage.prefabContentsRoot.transform.GetComponentsInChildren(true, scope.list); } else { var count = EditorSceneManager.loadedSceneCount; for (var i = 0; i < count; i++) { using (var gos = ListPoolScope <GameObject> .Create()) { var scene = EditorSceneManager.GetSceneAt(i); scene.GetRootGameObjects(gos.list); foreach (var go in gos.list) { go.GetComponentsInChildren(true, scope.list); } } } } for (var i = 0; i < scope.list.Count; i++) { if (func(scope.list[i])) { results.Add(scope.list[i]); } } } }
static Scene GetIsolationScene() { EditInIsolation edit = null; Scene result = default(Scene); // find the isolation scene for (int i = 0; i < EditorSceneManager.sceneCount; i++) { result = EditorSceneManager.GetSceneAt(i); GameObject[] roots = result.GetRootGameObjects(); edit = GetFrom(roots); if (edit != null) { break; } } // no isolation scene found, go ahead and make one if (edit == null) { Scene oldScene = EditorSceneManager.GetActiveScene(); Scene scene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Additive); EditorSceneManager.SetActiveScene(scene); GameObject go = new GameObject("_EditInIsolationScene"); go.AddComponent <EditInIsolation>(); EditorSceneManager.SetActiveScene(oldScene); result = scene; } return(result); }
static void CreatePresetFromOpenScenes() { var multi = CreateInstance <MultiScene>(); multi.name = "New Multi-Scene"; var activeScene = EditorSceneManager.GetActiveScene(); var sceneCount = EditorSceneManager.sceneCount; for (int i = 0; i < sceneCount; i++) { var scene = EditorSceneManager.GetSceneAt(i); var sceneAsset = AssetDatabase.LoadAssetAtPath <SceneAsset>(scene.path); if (activeScene == scene) { multi.activeScene = sceneAsset; } multi.sceneAssets.Add(new MultiScene.SceneInfo(sceneAsset, scene.isLoaded)); } var directory = AssetDatabase.GetAssetPath(Selection.activeObject.GetInstanceID()); var isDirectory = Directory.Exists(directory); if (!isDirectory) { directory = Path.GetDirectoryName(directory); } ProjectWindowUtil.CreateAsset(multi, string.Format("{0}/{1}.asset", directory, multi.name)); }
public static void ExportAllSelectedScene() { Scene currentScene = EditorSceneManager.GetSceneAt(0); var selection = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets); var paths = (from s in selection let path = AssetDatabase.GetAssetPath(s) where File.Exists(path) && path.EndsWith(".unity") select path).ToArray(); int num = 0; foreach (string item in paths) { EditorUtility.DisplayCancelableProgressBar("导出中", "这会要一些时间,请耐心等待 " + num + "/" + paths.Length, (float)num / (float)paths.Length); if (!EditorSceneManager.GetSceneByPath(item).isLoaded) { currentScene = EditorSceneManager.OpenScene(item); #if OBJECT ScenesFixer.FixFolderPosition(); #endif } WriteXml(); num++; Debug.Log("导出场景为" + item); EditorSceneManager.CloseScene(currentScene, true); } EditorUtility.ClearProgressBar(); }
private void UpdateFromScenes() { QuickStartEditorComponent quickStart = null; for (int i = 0; i < EditorSceneManager.sceneCount; i++) { foreach (GameObject rooGO in EditorSceneManager.GetSceneAt(i).GetRootGameObjects()) { if (rooGO.TryGetComponent(out quickStart)) { break; } } if (quickStart != null) { break; } } if (quickStart != null && quickStart.OverrideLevel) { _elementLevel.SetEnabled(!quickStart.OverrideLevel); _elementLevel.label = "Level (set by scene)"; _elementLevel.value = quickStart.Level.name; EditorLaunchData.level = quickStart.Level.name; } else { _elementLevel.SetEnabled(true); _elementLevel.label = "Level"; } }
static UnitySceneMemoHierarchyView() { if (!UnityEditorMemoPrefs.UnitySceneMemoActive) { return; } UnitySceneMemoHelper.Initialize(); if (UnitySceneMemoHelper.Data == null) { return; } EditorApplication.hierarchyWindowItemOnGUI += OnHierarchyView; Undo.undoRedoPerformed += () => { EditorApplication.RepaintHierarchyWindow(); for (int i = 0; i < EditorSceneManager.sceneCount; i++) { UnitySceneMemoHelper.InitializeSceneMemo(EditorSceneManager.GetSceneAt(i)); } }; #if UNITY_2019_1_OR_NEWER SceneView.duringSceneGui += (view) => { UnitySceneMemoSceneView.OnGUI(currentMemo); }; #else // draw at SceneView SceneView.onSceneGUIDelegate += (view) => { UnitySceneMemoSceneView.OnGUI(currentMemo); }; #endif }
public static void PrepareSprites() { for (int i = 0; i < EditorSceneManager.loadedSceneCount; i++) { Scene scene = EditorSceneManager.GetSceneAt(i); foreach (var root in scene.GetRootGameObjects()) { foreach (var node in TraverseTransformTree(root.transform)) { GameObject gameObject = node.gameObject; StaticEditorFlags flags = GameObjectUtility.GetStaticEditorFlags(gameObject); if ((flags & StaticEditorFlags.LightmapStatic) == 0) { continue; } SpriteRenderer spriteRenderer = node.GetComponent <SpriteRenderer>(); if (!spriteRenderer) { continue; } // Create if not find a BakedLigthingSpriteData BakedLigthingSpriteData data = gameObject.GetComponent <BakedLigthingSpriteData>(); if (!data) { data = gameObject.AddComponent <BakedLigthingSpriteData>(); } data.BuildMesh(); } } } EditorSceneManager.MarkAllScenesDirty(); }
static IEnumerable <SceneContext> GetAllSceneContexts() { var decoratedSceneNames = new List <string>(); for (int i = 0; i < EditorSceneManager.sceneCount; i++) { var scene = EditorSceneManager.GetSceneAt(i); var sceneContext = TryGetSceneContextForScene(scene); var decoratorContext = TryGetDecoratorContextForScene(scene); if (sceneContext != null) { Assert.That(decoratorContext == null, "Found both SceneDecoratorContext and SceneContext in the same scene '{0}'. This is not allowed", scene.name); decoratedSceneNames.RemoveAll(x => sceneContext.ContractNames.Contains(x)); yield return(sceneContext); } else if (decoratorContext != null) { Assert.That(!string.IsNullOrEmpty(decoratorContext.DecoratedContractName), "Missing Decorated Contract Name on SceneDecoratorContext in scene '{0}'", scene.name); decoratedSceneNames.Add(decoratorContext.DecoratedContractName); } } Assert.That(decoratedSceneNames.IsEmpty(), "Found decorator scenes without a corresponding scene to decorator. Missing scene contracts: {0}", decoratedSceneNames.Join(", ")); }
private void LoadAllScenes(BiomeType biome) { var scenes = AssetDatabase.FindAssets("t:Scene", new[] { "Assets/Scenes/Maps/" + biome.Name }); for (int i = 0; i < EditorSceneManager.sceneCount; i++) { if (EditorSceneManager.GetSceneAt(i).name != "MapSetup" && !EditorSceneManager.GetSceneAt(i).name.Contains(biome.Name)) { EditorSceneManager.UnloadSceneAsync(EditorSceneManager.GetSceneAt(i), UnloadSceneOptions.UnloadAllEmbeddedSceneObjects); } } foreach (var scene in scenes) { EditorSceneManager.OpenScene(AssetDatabase.GUIDToAssetPath(scene), OpenSceneMode.Additive); } if (EditorSceneManager.GetActiveScene().name != "MapSetup" && !EditorSceneManager.GetActiveScene().name.Contains(biome.Name)) { EditorSceneManager.UnloadSceneAsync(EditorSceneManager.GetActiveScene(), UnloadSceneOptions.UnloadAllEmbeddedSceneObjects); } if (!EditorSceneManager.GetSceneByName("MapSetup").IsValid()) { EditorSceneManager.OpenScene("Assets/Scenes/GamplaySetup/MapSetup.unity", OpenSceneMode.Additive); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); Activity activity = (Activity)target; if (GUILayout.Button("Open Activity")) { EditorSceneManager.SaveOpenScenes(); if (!EditorSceneManager.GetSceneByName(R.S.MainScene).isLoaded) { EditorSceneManager.OpenScene("Assets/Scenes/Main.unity", OpenSceneMode.Additive); } for (int i = 0; i < EditorSceneManager.loadedSceneCount; i++) { Scene currentScene = EditorSceneManager.GetSceneAt(i); if (currentScene.name != R.S.MainScene) { EditorSceneManager.CloseScene(EditorSceneManager.GetSceneAt(i), true); i--; } } foreach (var i in activity.Scenes) { EditorSceneManager.OpenScene("Assets/Scenes/" + i + ".unity", OpenSceneMode.Additive); } EditorSceneManager.OpenScene("Assets/Scenes/LoadingScreen.unity", OpenSceneMode.Additive); } }
/// <summary> /// Add the currently loaded scenes to the /// </summary> private void AddOpenedScenes() { for (int i = 0; i < EditorSceneManager.sceneCount; i++) { SceneAsset sceneAsset = AssetDatabase.LoadAssetAtPath(EditorSceneManager.GetSceneAt(i).path, typeof(SceneAsset)) as SceneAsset; if (SceneAssets.ContainsObjects(sceneAsset)) { continue; } if (sceneAsset.IsPersistantScene()) { continue; } if (SceneAssets.arraySize > 0) { SceneAssets.InsertArrayElementAtIndex(SceneAssets.arraySize - 1); } else { SceneAssets.InsertArrayElementAtIndex(0); } SceneAssets.GetArrayElementAtIndex(SceneAssets.arraySize - 1).objectReferenceValue = sceneAsset; UpdateScenesLabels(); } }
void Start() { #if UNITY_EDITOR // Update scene names in editor only sceneNames = linkedScenes.Select(l => l.name).ToArray(); #endif if (Application.isPlaying) { return; } if (sceneNames != null && sceneNames.Length > 0) { for (int i = 0; i < sceneNames.Length; ++i) { #if UNITY_EDITOR EditorSceneManager.OpenScene(AssetDatabase.GetAssetPath(linkedScenes[i]), OpenSceneMode.Additive); #else SceneManager.LoadScene(sceneNames[i], LoadSceneMode.Additive); #endif } #if UNITY_EDITOR EditorSceneManager.SetActiveScene(EditorSceneManager.GetSceneAt(0)); #endif } }
static List <UdonBehaviour> GetAllUdonBehaviours() { int sceneCount = EditorSceneManager.loadedSceneCount; int maxGameObjectCount = 0; for (int i = 0; i < sceneCount; ++i) { maxGameObjectCount = Mathf.Max(maxGameObjectCount, EditorSceneManager.GetSceneAt(i).rootCount); } List <GameObject> rootObjects = new List <GameObject>(maxGameObjectCount); List <UdonBehaviour> behaviourList = new List <UdonBehaviour>(); for (int i = 0; i < sceneCount; ++i) { Scene scene = EditorSceneManager.GetSceneAt(i); if (scene.isLoaded) { int rootCount = scene.rootCount; scene.GetRootGameObjects(rootObjects); for (int j = 0; j < rootCount; ++j) { behaviourList.AddRange(rootObjects[j].GetComponentsInChildren <UdonBehaviour>(true)); } } } return(behaviourList); }
public static void OnPostprocessScene() { if (!BuildPipeline.isBuildingPlayer) { return; } for (var i = 0; i < EditorSceneManager.loadedSceneCount; ++i) { var scene = EditorSceneManager.GetSceneAt(i); var behaviours = new HashSet <MonoBehaviour>(); CollectBehaviours <TE3AutoRandomSpawner>(scene, behaviours); CollectBehaviours <TE3LightmapProxy>(scene, behaviours); //CollectBehaviours<TE3LODGroupProxy>(scene, behaviours); CollectBehaviours <TE3RandomSpawner>(scene, behaviours); CollectBehaviours <TE3ScatterArea>(scene, behaviours); CollectBehaviours <TE3ScatterProxy>(scene, behaviours); //CollectBehaviours<TE3TerrainMaterialPicker>(scene, behaviours); //CollectBehaviours<TE3TerrainMaterialProjector>(scene, behaviours); var stripped = 0; foreach (var b in behaviours) { Object.DestroyImmediate(b); ++stripped; } Debug.LogFormat("TE3 stripped out {0} editor-only behaviours from scene '{1}'.", stripped, scene.name); } }
static void collapseHierarchy() { string assemblypath = UnityEditorInternal.InternalEditorUtility.GetEditorAssemblyPath(); var assembly = System.Reflection.Assembly.LoadFrom(assemblypath); var type = assembly.GetType("UnityEditor.SceneHierarchyWindow"); var browserfield = type.GetField("s_LastInteractedHierarchy", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static); var browser = browserfield.GetValue(type); var treestatefield = type.GetField("m_TreeViewState", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); var treestate = treestatefield.GetValue(browser); var expandedIdsField = treestate.GetType().GetField("m_ExpandedIDs", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); expandedIdsField.SetValue(treestate, new List <int>()); List <string> openscenes = new List <string>(); for (int i = 0; i < EditorSceneManager.sceneCount; i++) { openscenes.Add(EditorSceneManager.GetSceneAt(i).name); } var reloadneeded = type.GetField("m_TreeViewReloadNeeded", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); type.InvokeMember("SetScenesExpanded", System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic, null, browser, new object[1] { openscenes }); reloadneeded.SetValue(browser, true); type.InvokeMember("SyncIfNeeded", System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic, null, browser, null); }
private static void EditorApplication_playModeStateChanged() { bool isExitingEditMode = !EditorApplication.isPlaying && EditorApplication.isPlayingOrWillChangePlaymode; #endif #if UNITY_5_6_OR_NEWER if ( EditorUtility.scriptCompilationFailed ) { AmsDebug.Log( null, "Skipping cross-scene references due to compilation errors" ); return; } #endif if ( isExitingEditMode ) { List<Scene> allScenes = new List<Scene>( EditorSceneManager.sceneCount ); for (int i = 0 ; i < EditorSceneManager.sceneCount ; ++i) { var scene = EditorSceneManager.GetSceneAt(i); if ( scene.IsValid() && scene.isLoaded ) allScenes.Add( scene ); } AmsDebug.Log( null, "Handling Cross-Scene Referencing for Playmode" ); AmsSaveProcessor.HandleCrossSceneReferences( allScenes ); } }
/// <summary> /// Save all scenes and close them /// </summary> public static void CloseAllScenesInEditor(params string[] filter) { SaveAllOpenScenesInEditor(); for (int i = 0; i < EditorSceneManager.sceneCount; i++) { Scene scene = EditorSceneManager.GetSceneAt(i); bool isSceneFiltered = false; for (int k = 0; k < filter.Length; k++) { if (scene.name == filter[k]) { isSceneFiltered = true; break; } } if (isSceneFiltered) { continue; } EditorSceneManager.CloseScene(scene, true); } }
public void UnloadOtherScenes(string [] ignoreScenes) { #if UNITY_EDITOR int numScenes = EditorSceneManager.loadedSceneCount; #else int numScenes = SceneManager.sceneCount; #endif for (int i = 0; i < numScenes; i++) { Scene scene; #if UNITY_EDITOR scene = EditorSceneManager.GetSceneAt(i); #else scene = SceneManager.GetSceneAt(i); #endif if (System.Array.Exists <string>(ignoreScenes, (x) => x.Equals(scene.path))) { continue; } #if UNITY_EDITOR mCurrentUnloadOps.Add(EditorSceneManager.UnloadSceneAsync(scene)); #else mCurrentUnloadOps.Add(SceneManager.UnloadSceneAsync(scene)); #endif } }