using UnityEditor; using UnityEngine; namespace Utils.Editor { [CustomPropertyDrawer(typeof(ReadOnlyOnPlayFieldAttribute))] public class ReadOnlyOnPlayFieldDrawer : PropertyDrawer { public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { var state = Application.isPlaying; if (state) GUI.enabled = false; EditorGUI.PropertyField(position, property, label, true); if (state) GUI.enabled = true; } } }