/**************************************************** 文件:CreatScriptableObject.cs 作者:张铮 邮箱:834207172@qq.com 日期:2022/3/7 18:26:10 功能: *****************************************************/ using System; using System.Collections.Generic; using System.Linq; using Sirenix.OdinInspector.Editor; using Sirenix.Utilities; using UnityEditor; using UnityEngine; namespace Stary.Evo.Editor { public class CreatScriptableObject : OdinMenuEditorWindow { [MenuItem("Evo/Utility/ScriptObject/查找", false, 3)] //[MenuItem("Assets/Create Scriptable Object", priority = -1000)] private static void ShowDialog() { GetWindow().Show(); } /// /// 获取继承 ScriptableObject 且不是Editor相关的所有自定义类(也就是自己编写的类) /// // static HashSet scriptableObjectTypes = AssemblyUtilities.GetTypes(AssemblyTypeFlags.CustomTypes) // .Where(t => // t.IsClass && // typeof(ScriptableObject).IsAssignableFrom(t) && // !typeof(EditorWindow).IsAssignableFrom(t) && // !typeof(Editor).IsAssignableFrom(t) && t.GetCustomAttribute() != null) // .ToHashSet(); protected override OdinMenuTree BuildMenuTree() { OdinMenuTree tree = new OdinMenuTree(false); //不支持多选 tree.Selection.SupportsMultiSelect = false; tree.AddAllAssetsAtPath("预览ScriptableObject", "Assets/Domain", typeof(ScriptableObject), true, true); // tree.AddAllAssetsAtPath("预览ScriptableObject", "Assets/~Resources", typeof(ScriptableObject), true, true); return tree; } } }