/// <summary> /// Finds or creates the singleton database. /// </summary> /// <returns></returns> public static TypeCatalogue EnsureExists() { if (single == null) { single = Resources.Load <TypeCatalogue>("TypeCatalogue"); } if (single == null) { single = ScriptableObject.CreateInstance <TypeCatalogue>(); if (!Directory.Exists(codegenEditorResourcePath)) { Directory.CreateDirectory(codegenEditorResourcePath); Debug.Log("Expected directory for TypeCatalogue ScriptableObject asset does not exist. Creating :" + codegenEditorResourcePath); } AssetDatabase.CreateAsset(single, codegenEditorResourcePath + "TypeCatalogue.asset"); AssetDatabase.Refresh(); } return(single); }
/// <summary> /// Finds or creates the singleton database. /// </summary> /// <returns></returns> public static TypeCatalogue EnsureExists() { if (single == null) { single = Resources.Load <TypeCatalogue>("TypeCatalogue"); } if (single == null) { single = ScriptableObject.CreateInstance <TypeCatalogue>(); if (!Directory.Exists(CODEGEN_EDITOR_RESOURCE_PATH)) { Directory.CreateDirectory(CODEGEN_EDITOR_RESOURCE_PATH); Debug.Log("Expected directory for TypeCatalogue ScriptableObject asset does not exist. Creating :" + CODEGEN_EDITOR_RESOURCE_PATH); } AssetDatabase.CreateAsset(single, CODEGEN_EDITOR_RESOURCE_PATH + "TypeCatalogue.asset"); AssetDatabase.Refresh(); } return(single); }