public void DrawDeleteFolderButton(GUIContent content, AH_TreeviewElement folder, GUIStyle style, string dialogHeader, string dialogDescription, params GUILayoutOption[] layout) { if (GUILayout.Button(content, style, layout)) { deleteUnusedFromFolder(dialogHeader, dialogDescription, folder); } }
private void DrawDeleteFolderButton(AH_TreeviewElement folder) { if (multiColumnHeader.ShowMode != AH_MultiColumnHeader.AssetShowMode.Unused) { return; } string description = "Delete unused assets from folder"; GUIContent content = new GUIContent("Delete " + (AH_Utils.GetSizeAsString(folder.GetFileSizeRecursively(AH_MultiColumnHeader.AssetShowMode.Unused))), description); GUIStyle style = new GUIStyle(GUI.skin.button); DrawDeleteFolderButton(content, folder, style, description, "Do you want to delete all unused assets from:" + Environment.NewLine + folder.RelativePath, GUILayout.Width(160), GUILayout.Height(32)); }
private static void populateDumpListRecursively(AH_TreeviewElement element, AH_MultiColumnHeader.AssetShowMode showmode, ref List <AssetDumpData> elements) { if (element.HasChildrenThatMatchesState(showmode)) { foreach (var child in element.children) { populateDumpListRecursively((AH_TreeviewElement)child, showmode, ref elements); } } else if (element.AssetMatchesState(showmode)) { UnityEngine.Debug.Log("Adding " + element.Name); elements.Add(new AssetDumpData(element.GUID, element.AbsPath, element.RelativePath, element.AssetSize, element.FileSize, element.UsedInBuild, element.ScenesReferencingAsset)); } }
private void deleteUnusedFromFolder(string header, string description, AH_TreeviewElement folder) { int choice = EditorUtility.DisplayDialogComplex(header, description, "Yes", "Cancel", "Backup (Slow)"); List <string> affectedAssets = new List <string>(); if (choice != 1)//Not Cancel { //Collect affected assets affectedAssets = folder.GetUnusedPathsRecursively(); } if (choice == 0)//Delete { deleteMultipleAssets(affectedAssets); } else if (choice == 2)//Backup { exportAssetsToPackage("Backup as unitypackage", affectedAssets); } }
private void deleteUnusedFromFolder(AH_TreeviewElement folder) { deleteUnusedFromFolder("Delete unused assets from folder", "Do you want to delete all unused assets from:" + Environment.NewLine + folder.RelativePath, folder); }