You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
710 B
C#
24 lines
710 B
C#
3 months ago
|
using System;
|
||
|
using System.Reflection;
|
||
|
using UnityEditor;
|
||
|
using Object = UnityEngine.Object;
|
||
|
|
||
|
namespace AV.Inspector
|
||
|
{
|
||
|
internal static class EditorUtils
|
||
|
{
|
||
|
static Assembly EditorAssembly { get; } = typeof(Editor).Assembly;
|
||
|
|
||
|
internal static class Presets
|
||
|
{
|
||
|
static Type menuType = EditorAssembly.GetType("UnityEditor.Presets.PresetContextMenu");
|
||
|
|
||
|
static MethodInfo CreateAndShow = menuType.GetMethod("CreateAndShow", BindingFlags.NonPublic | BindingFlags.Static);
|
||
|
|
||
|
public static void ShowMenu(params Object[] targets)
|
||
|
{
|
||
|
CreateAndShow.Invoke(null, new object[] { targets });
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|