protected void CompleteSceneLoading(ProjectItem scene, ProjectManagerCallback callback, bool isEnabled, PersistentScene persistentScene) { PersistentScene.InstantiateGameObjects(persistentScene); m_project.UnloadData(scene); ExtraSceneData extraData = FindObjectOfType <ExtraSceneData>(); RuntimeUndo.Enabled = false; RuntimeSelection.objects = extraData.Selection; RuntimeUndo.Enabled = isEnabled; Destroy(extraData.gameObject); m_activeScene = scene; if (callback != null) { callback(); } RaiseSceneLoaded(scene); }
public static void LoadScene() { string path = EditorUtility.OpenFilePanel("Open Scene", Application.persistentDataPath, "rtsc"); if (path.Length != 0) { IProject project = Dependencies.Project; ISerializer serializer = Dependencies.Serializer; project.Load(new[] { path }, loadDataCompleted => { ProjectItem scene = loadDataCompleted.Data[0]; PersistentScene persistentScene = serializer.Deserialize <PersistentScene>(scene.Internal_Data.RawData); PersistentScene.InstantiateGameObjects(persistentScene); project.UnloadData(scene); ExtraSceneData extraData = Object.FindObjectOfType <ExtraSceneData>(); Object.DestroyImmediate(extraData.gameObject); }); } }