public static void CreateInstaller() { DIEditorUtilities.AddCSharpClassTemplate("Installer", "NewInstaller", "using UnityEngine;" + "\nusing HandyPackage;" + "\n" + "\npublic class CLASS_NAME : Installer<CLASS_NAME>" + "\n{" + "\n public override void InstallDependencies()" + "\n {" + "\n }" + "\n}"); }
public static void CreateScriptableObjectInstaller() { DIEditorUtilities.AddCSharpClassTemplate("Scriptable Object Installer", "NewScriptableObjectInstaller", "using UnityEngine;" + "\nusing HandyPackage;" + "\n" + "\n[CreateAssetMenu(fileName = \"CLASS_NAME\", menuName = \"Installers/CLASS_NAME\")]" + "\npublic class CLASS_NAME : ScriptableObjectInstaller" + "\n{" + "\n public override void InstallDependencies()" + "\n {" + "\n }" + "\n}"); }
static void CreateProjectContextInternal(string absoluteDir) { var assetPath = DIEditorUtilities.ConvertFullAbsolutePathToAssetPath(absoluteDir); var prefabPath = Path.Combine(assetPath, "NewProjectContext.prefab").Replace("\\", "/"); var gameObject = new GameObject(); try { gameObject.AddComponent <ProjectContext>(); #if UNITY_2018_3_OR_NEWER var prefabObj = PrefabUtility.SaveAsPrefabAsset(gameObject, prefabPath); #else var prefabObj = PrefabUtility.ReplacePrefab(gameObject, PrefabUtility.CreateEmptyPrefab(prefabPath)); #endif Selection.activeObject = prefabObj; } finally { GameObject.DestroyImmediate(gameObject); } }
public static void CreateProjectContext() { var absoluteDir = DIEditorUtilities.GetCurrentDirectoryAssetPathFromSelection(); CreateProjectContextInternal(absoluteDir); }