51 lines
1.8 KiB
C#
51 lines
1.8 KiB
C#
|
|
/****************************************************
|
|||
|
|
文件: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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|