mirror of
https://github.com/maxartz15/UnitySerializedReferenceUI.git
synced 2025-06-28 07:06:08 +02:00
organize into upm directory structure
This commit is contained in:
@ -0,0 +1,8 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class SerializeReferenceMenuAttribute : PropertyAttribute
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f1c372fa681cf146973df30a0d969fd
|
||||
timeCreated: 1579584059
|
@ -0,0 +1,26 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomPropertyDrawer(typeof(SerializeReferenceMenuAttribute))]
|
||||
public class SerializeReferenceMenuAttributeDrawer : PropertyDrawer
|
||||
{
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return EditorGUI.GetPropertyHeight(property, true);
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
|
||||
var typeRestrictions = SerializedReferenceUIDefaultTypeRestrictions.GetAllBuiltInTypeRestrictions(fieldInfo);
|
||||
property.ShowContextMenuForManagedReferenceOnMouseMiddleButton(position, typeRestrictions);
|
||||
|
||||
EditorGUI.PropertyField(position, property, true);
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eaa31b1c39ee9424abe12fa0034d9d1b
|
||||
timeCreated: 1579584059
|
Reference in New Issue
Block a user