mirror of
https://github.com/maxartz15/UnitySerializedReferenceUI.git
synced 2025-06-28 07:06:08 +02:00
Folders redirection
This commit is contained in:
@ -0,0 +1,8 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class SerializeReferenceButtonAttribute : PropertyAttribute
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c64e0f68b41b48939c9b98cc29a19b20
|
||||
timeCreated: 1579584059
|
@ -0,0 +1,31 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomPropertyDrawer(typeof(SerializeReferenceButtonAttribute))]
|
||||
public class SerializeReferenceButtonAttributeDrawer : 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 labelPosition = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);
|
||||
EditorGUI.LabelField(labelPosition, label);
|
||||
|
||||
var typeRestrictions = SerializedReferenceUIBuiltInTypeRestrictions.GetAllBuiltInTypeRestrictions(fieldInfo);
|
||||
property.DrawSelectionButtonForManagedReference(position, typeRestrictions);
|
||||
|
||||
EditorGUI.PropertyField(position, property, GUIContent.none, true);
|
||||
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
}
|
||||
#endif
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a07638044724309b6088c28a11a15af
|
||||
timeCreated: 1579584059
|
Reference in New Issue
Block a user