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

20 lines
476 B
C#

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