Files
Master-Arbeit-Tom-Hempel/Unity-Master/Assets/Convai/Scripts/Editor/UI/ReadOnlyDrawer.cs
2025-09-21 22:42:26 +02:00

17 lines
547 B
C#

using Convai.Scripts.Runtime.Attributes;
using UnityEditor;
using UnityEngine;
namespace Convai.Scripts.Editor.UI
{
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
public class ReadOnlyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
GUI.enabled = false; // Disable the property field
EditorGUI.PropertyField(position, property, label, true);
GUI.enabled = true; // Re-enable the property field
}
}
}