Folders redirection

This commit is contained in:
TextusGames
2020-05-16 16:28:15 +03:00
parent 0581978db8
commit 925fe29da1
71 changed files with 0 additions and 8 deletions

View File

@ -0,0 +1,8 @@
using System;
using UnityEngine;
[AttributeUsage(AttributeTargets.Field)]
public class SerializeReferenceButtonAttribute : PropertyAttribute
{
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c64e0f68b41b48939c9b98cc29a19b20
timeCreated: 1579584059

View File

@ -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

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5a07638044724309b6088c28a11a15af
timeCreated: 1579584059