using KitsuneCafe.System; using UnityEditor; using UnityEditor.UIElements; using UnityEngine.UIElements; [CustomPropertyDrawer(typeof(Duration))] public class DurationPropertyDrawer : PropertyDrawer { public override VisualElement CreatePropertyGUI(SerializedProperty property) { var container = new VisualElement(); container.style.flexDirection = FlexDirection.Row; var duration = new PropertyField( property.FindPropertyRelative("displayValue"), ObjectNames.NicifyVariableName(property.name) ); duration.style.flexGrow = 1; var unit = new EnumField { bindingPath = "unit" }; unit.style.flexGrow = 0; container.Add(duration); container.Add(unit); return container; } }