/// <summary> /// Loads the utmodule at the given file path /// </summary> /// <param name="moduleFile">Relative path to the .utmodule file</param> public static void LoadModule(string moduleFile) { Assert.IsFalse(EditorApplication.isPlayingOrWillChangePlaymode); var context = new UTinyContext(); var registry = context.Registry; UTinyPersistence.LoadModule(moduleFile, registry); var module = registry.FindAllBySource(UTinyRegistry.DefaultSourceIdentifier).OfType <UTinyModule>().First(); Assert.IsNotNull(module); module.Name = Path.GetFileNameWithoutExtension(moduleFile); SetupModule(registry, module); var project = registry.CreateProject(UTinyId.Generate(KWorkspaceProjectName), KWorkspaceProjectName); project.Module = (UTinyModule.Reference)module; var editorContext = new UTinyEditorContext((UTinyProject.Reference)project, EditorContextType.Module, context, UTinyEditorPrefs.LoadWorkspace(project.PersistenceId)); LoadContext(editorContext, isChanged: false); }
/// <summary> /// Loads the utproject at the given file path /// </summary> /// <param name="projectFile">Relative path to the .utproject file</param> public static void LoadProject(string projectFile) { Assert.IsFalse(EditorApplication.isPlayingOrWillChangePlaymode); var context = new UTinyContext(); var registry = context.Registry; UTinyPersistence.LoadProject(projectFile, registry); var project = registry.FindAllByType <UTinyProject>().First(); Assert.IsNotNull(project); project.Name = Path.GetFileNameWithoutExtension(projectFile); SetupProject(registry, project); var editorContext = new UTinyEditorContext((UTinyProject.Reference)project, EditorContextType.Project, context, UTinyEditorPrefs.LoadWorkspace(project.PersistenceId)); LoadContext(editorContext, isChanged: false); }