private void OnEnable() { _exportSettings = new EditorScriptableSingleton <ExportSettings>(); _editorSelector = new EditorSelector(_exportSettings.Instance.SelectedEditor); _editorSelector.Add(new PrefabEditor(this)); _editorSelector.Add(new SceneEditor(this)); _editorSelector.Add(new ArtifactEditor(this)); _editorSelector.Add(new PreloadAssemblyEditor(this)); _editorSelector.Add(new RuntimeAssemblyEditor(this)); _editorSelector.Add(new DependencyEditor(this)); _editorSelector.Add(new ExportEditor(this)); }
public virtual void SaveData(bool saveAsText = true) { if (EditorScriptableSingleton <T> .s_Instance == null) { Debug.Log("Cannot save ScriptableSingleton: no instance!"); return; } string filePath = EditorScriptableSingleton <T> .GetFilePath(); if (!string.IsNullOrEmpty(filePath)) { string directoryName = Path.GetDirectoryName(filePath); if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } InternalEditorUtility.SaveToSerializedFileAndForget(new T[] { EditorScriptableSingleton <T> .s_Instance }, filePath, saveAsText); } }
private static void CreateOrLoad() { string filePath = EditorScriptableSingleton <T> .GetFilePath(); if (!string.IsNullOrEmpty(filePath)) { var objs = InternalEditorUtility.LoadSerializedFileAndForget(filePath); if (objs.Length > 0) { s_Instance = objs [0] as T; } } if (EditorScriptableSingleton <T> .s_Instance == null) { T t = ScriptableObject.CreateInstance <T>(); t.hideFlags = HideFlags.HideAndDontSave; s_Instance = t; var b = s_Instance as EditorScriptableSingleton <T>; b.OnCreateInstance(); } }
public static void ExportMod() { var singleton = new EditorScriptableSingleton <ExportSettings>(); Export.ExportMod(singleton.Instance); }