CapersProject/Assets/BOXOPHOBIC/Utils/Editor/StyledInspector/StyledInteractiveDrawer.cs

29 lines
699 B
C#
Raw Normal View History

2025-02-28 15:44:25 +00:00
// Cristian Pop - https://boxophobic.com/
using UnityEngine;
using UnityEditor;
namespace Boxophobic.StyledGUI
{
[CustomPropertyDrawer(typeof(StyledInteractive))]
public class StyledInteractiveAttributeDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
if (property.boolValue == true)
{
GUI.enabled = true;
}
else
{
GUI.enabled = false;
}
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
return -2;
}
}
}