module-inspector/Editor/ValueModifiers/DrawerLargerThanField.cs

17 lines
655 B
C#

using UnityEditor;
namespace Module.Inspector.Editor
{
[CustomPropertyDrawer(typeof(LargerThanField))]
internal sealed class DrawerLargerThanField : ValueModifierPropertyDrawer
{
public override void Modify(ValueModifierPropertyAttribute attribute, SerializedProperty property)
{
var att = (LargerThanField)attribute;
SerializedPropertyExtension.ECompareType compareType = property.IsGreaterOrEqualToSiblingValue(att.fieldName);
if (compareType == SerializedPropertyExtension.ECompareType.False)
property.SetValueTo(property.GetSibling(att.fieldName));
}
}
}