2020-05-16 15:17:04 +02:00
|
|
|
|
#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)
|
2020-05-16 15:17:04 +02:00
|
|
|
|
{
|
2022-12-28 14:03:46 +01:00
|
|
|
|
Event e = Event.current;
|
|
|
|
|
if (e.type != EventType.MouseDown || !position.Contains(e.mousePosition) || e.button != 2)
|
|
|
|
|
{
|
2020-05-16 15:17:04 +02:00
|
|
|
|
return;
|
2022-12-28 14:03:46 +01:00
|
|
|
|
}
|
2020-05-16 15:17:04 +02:00
|
|
|
|
|
|
|
|
|
property.ShowContextMenuForManagedReference(filters);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|