Utils/Editor/ReadOnlyFieldDrawer.cs
Alexander Filippov fe555652c3 First commit
2021-06-27 14:46:18 +02:00

17 lines
445 B
C#

using UnityEditor;
using UnityEngine;
namespace Agoxandr.Utils
{
[CustomPropertyDrawer(typeof(ReadOnlyFieldAttribute))]
public class ReadOnlyFieldDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
GUI.enabled = false;
EditorGUI.PropertyField(position, property, label, true);
GUI.enabled = true;
}
}
}