/// <summary> // This makes it easy to create, name and place unique new ScriptableObject asset files. /// </summary> public static void CreateAssets(OCDelegate[] assets) { string path = AssetDatabase.GetAssetPath(Selection.activeObject); if (path == "") { path = "Assets"; } else if (Path.GetExtension(path) != "") { path = path.Replace(Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)), ""); } path += "/OpenCog Assets/OtherAssets/ActionConditions/"; foreach (OCDelegate asset in assets) { string basePath = path + asset.Name + " " + typeof(OCDelegate).Name + ".asset"; OCDelegate existingAsset = (OCDelegate)AssetDatabase.LoadAssetAtPath(basePath, typeof(OCDelegate)); if (existingAsset != null) { AssetDatabase.DeleteAsset(basePath); } string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(basePath); AssetDatabase.CreateAsset(asset, assetPathAndName); } AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = assets[0]; }
protected void DeleteAll(params string[] π) { foreach (var x in π) { if (x != null) { ADB.DeleteAsset(x); } } }
protected void DeleteViaADB(string x) => ADB.DeleteAsset(x);