/// <summary> /// データ作成(Projectウィンドウで名前入力) /// </summary> public static T CreateData <T>(string dataName) where T : ScriptableObject { var directory = ExportConfig.GetDataExportDirectory(); var path = directory + "/" + dataName + ".asset"; Debug.Log(path); var instance = ScriptableObject.CreateInstance <T>(); ProjectWindowUtil.CreateAsset(instance, path); return(instance); }
/// <summary> /// データ作成(名前入力無しですぐに作成) /// </summary> public static T CreateDataImmediately <T>(string dataName) where T : ScriptableObject { // return CreateDataImmediately_Project<T>(rootFolderName, saveFolderRelativePath, dataName); var directory = ExportConfig.GetDataExportDirectory(); var path = Path.Combine(directory, dataName + ".asset"); path = AssetDatabase.GenerateUniqueAssetPath(path); var instance = ScriptableObject.CreateInstance <T>(); Debug.Log("Create: " + path, instance); AssetDatabase.CreateAsset(instance, path); EditorGUIUtility.PingObject(instance); return(instance); }