17 lines
516 B
C#
17 lines
516 B
C#
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace Utils
|
|
{
|
|
[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;
|
|
}
|
|
}
|
|
} |