20 lines
494 B
C#
20 lines
494 B
C#
using UnityEditor;
|
|
using UnityEngine.UIElements;
|
|
|
|
namespace EditorAttributes.Editor
|
|
{
|
|
[CustomPropertyDrawer(typeof(DisableInEditModeAttribute))]
|
|
public class DisableInEditModeDrawer : PropertyDrawerBase
|
|
{
|
|
public override VisualElement CreatePropertyGUI(SerializedProperty property)
|
|
{
|
|
var root = new VisualElement();
|
|
|
|
root.Add(CreatePropertyField(property));
|
|
root.SetEnabled(EditorApplication.isPlayingOrWillChangePlaymode);
|
|
|
|
return root;
|
|
}
|
|
}
|
|
}
|