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

20 lines
477 B
C#

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