Files
plugin-library/Assets/00.StaryEvo/Editor/Create/CreatScriptableObject/CreatScriptableObject.cs
2025-03-31 11:16:52 +08:00

51 lines
1.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/****************************************************
文件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<CreatScriptableObject>().Show();
}
/// <summary>
/// 获取继承 ScriptableObject 且不是Editor相关的所有自定义类也就是自己编写的类
/// </summary>
// static HashSet<Type> scriptableObjectTypes = AssemblyUtilities.GetTypes(AssemblyTypeFlags.CustomTypes)
// .Where(t =>
// t.IsClass &&
// typeof(ScriptableObject).IsAssignableFrom(t) &&
// !typeof(EditorWindow).IsAssignableFrom(t) &&
// !typeof(Editor).IsAssignableFrom(t) && t.GetCustomAttribute<ScriptableObjectEditorAttribute>() != 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;
}
}
}