UnitySerializedReferenceUI/Editor/DefaultUI/SerializeReferenceInspectorMiddleMouseMenu.cs

20 lines
608 B
C#
Raw Normal View History

#if UNITY_EDITOR
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public static class SerializeReferenceInspectorMiddleMouseMenu
{
2022-12-28 14:03:46 +01:00
public static void ShowContextMenuForManagedReferenceOnMouseMiddleButton(this SerializedProperty property, Rect position, IEnumerable<Func<Type, bool>> filters = null)
{
2022-12-28 14:03:46 +01:00
Event e = Event.current;
if (e.type != EventType.MouseDown || !position.Contains(e.mousePosition) || e.button != 2)
{
return;
2022-12-28 14:03:46 +01:00
}
property.ShowContextMenuForManagedReference(filters);
}
}
#endif