private void ImportScene(string path) { EditorSceneManager.OpenScene(path, UnityEditor.SceneManagement.OpenSceneMode.Additive); Scene scene = SceneManager.GetSceneByPath(path); Scene activeScene = EditorSceneManager.GetActiveScene(); EditorSceneManager.MergeScenes(scene, activeScene); }
static void ExitFromEdit() { if (!ESM.SaveCurrentModifiedScenesIfUserWantsTo()) { CancelPlayMode = true; return; } SceneSetups = ESM.GetSceneManagerSetup(); ESM.OpenScene(SceneUtility.GetScenePathByBuildIndex(0), OpenSceneMode.Single); }
public UniTask AddingAsync(Scenes scene, Action <DiContainer> extraBindings = null) { var sceneAsset = GetScenes(scene.ToString()); if (sceneAsset == null) { Debug.LogWarning("Scene Load Warrning : Loaded Scene"); return(UniTask.CompletedTask); } SceneManager.OpenScene(AssetDatabase.GetAssetPath(sceneAsset), OpenSceneMode.Additive); return(UniTask.CompletedTask); }
private void ImportScene(string path) { WindowView windowController = GameObject.FindObjectOfType <WindowView>(); if (windowController == null) { Debug.LogError("WindowController not found in scene."); return; } Scene scene = EditorSceneManager.OpenScene(path, UnityEditor.SceneManagement.OpenSceneMode.Additive); Scene activeScene = EditorSceneManager.GetActiveScene(); ScreenView screenController = null; //EditorSceneManager.MergeScenes(scene, activeScene); GameObject[] rootObjects = scene.GetRootGameObjects(); foreach (GameObject rootObject in rootObjects) { screenController = rootObject.GetComponent <ScreenView>(); if (screenController != null) { break; } } if (screenController == null) { Debug.LogError("ScreenController not found in loaded scene. "); SceneManager.UnloadSceneAsync(scene); return; } else { if (_loadedScreenCache == null) { GameObject cache = new GameObject("Cache"); _loadedScreenCache = cache.AddComponent <LoadedScreenCache>(); } _loadedScreen = new LoadedScreen(scene, screenController, _loadedScreenCache); GameObject duplicateScreen = _loadedScreen.GetDuplicateScreen(); duplicateScreen.transform.SetParent(windowController.transform, false); RectTransform rectTransform = duplicateScreen.GetComponent <RectTransform>(); if (rectTransform) { rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMax = Vector2.zero; rectTransform.offsetMin = Vector2.zero; rectTransform.hasChanged = false; } _loadedScreenCache.scenePath = scene.path; _loadedScreenCache._duplicateScreen = duplicateScreen; screenController.gameObject.SetActive(false); } }
private void OpenScene(string path) { EditorSceneManager.OpenScene(path); }