This repository has been archived on 2024-11-03. You can view files and clone it, but cannot push or open issues or pull requests.
snakeinabox/Assets/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ReadOnlyPropertyDrawer.cs
2020-07-09 11:41:01 -07:00

16 lines
410 B
C#

using UnityEditor;
using UnityEngine;
namespace NaughtyAttributes.Editor
{
[PropertyDrawer(typeof(ReadOnlyAttribute))]
public class ReadOnlyPropertyDrawer : PropertyDrawer
{
public override void DrawProperty(SerializedProperty property)
{
GUI.enabled = false;
EditorDrawUtility.DrawPropertyField(property);
GUI.enabled = true;
}
}
}