namespace deleteUtility { using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; using UnityEditor; using UnityEngine; public class DeleteUtilityWindow : EditorWindow { #region Config protected DeleteUtility Instance; protected SerializedProperty Folder; protected SerializedObject SerializedObject; #endregion [MenuItem("DashGame/DeleteUtility")] protected static void ShowWindow() { Type inspectorType = Type.GetType("UnityEditor.InspectorWindow,UnityEditor.dll"); DeleteUtilityWindow window = GetWindow(inspectorType); window.titleContent = new GUIContent("DeleteUtility"); window.Show(); } private void OnEnable() { Instance = InstanceManager.SearchInstance(); SerializedObject = new SerializedObject(Instance); Folder = SerializedObject.FindProperty("Folder"); } private void OnGUI() { SerializedObject.Update(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(Folder, new GUIContent("Folder")); if (GUILayout.Button("UseSelectedPath", GUILayout.MaxWidth(120))) { GetSelectedPath(ref Instance.Folder); } EditorGUILayout.EndHorizontal(); SerializedObject.ApplyModifiedProperties(); } protected void GetSelectedPath(ref string value) { if (Selection.assetGUIDs.Length > 0) { string path = AssetDatabase.GUIDToAssetPath(Selection.assetGUIDs[0]); path = Path.GetDirectoryName(path); if (string.IsNullOrEmpty(path)) { value = "Assets"; } else { value = path; } } } } }