Files
test/Assets/EditorAttributes/Editor/Scripts/Drawers/MiscellaneousAttributeDrawers/DisableInPlayModeDrawer.cs
T

20 lines
495 B
C#

using UnityEditor;
using UnityEngine.UIElements;
namespace EditorAttributes.Editor
{
[CustomPropertyDrawer(typeof(DisableInPlayModeAttribute))]
public class DisableInPlayModeDrawer : PropertyDrawerBase
{
public override VisualElement CreatePropertyGUI(SerializedProperty property)
{
var root = new VisualElement();
root.Add(CreatePropertyField(property));
root.SetEnabled(!EditorApplication.isPlayingOrWillChangePlaymode);
return root;
}
}
}