public static bool IsEnabled <T>(PropertyDrawer drawer, SerializedProperty property) where T : ConditionAttribute { var state = false; var attribute = drawer.GetAttribute <T>(); if (attribute != null) { if (string.IsNullOrEmpty(attribute.fieldName) == false) { var bitMask = attribute.bitMask; var inverseCondition = attribute.inverseCondition; var needState = attribute.state; var prop = PropertyExtensions.GetRelativeProperty(property, property.propertyPath, attribute.fieldName); if (prop != null) { var value = PropertyExtensions.GetRawValue(prop, attribute); if (bitMask == true) { var result = 0; if (needState is byte) { result = ((int)value & (byte)needState); } else if (needState is int) { result = ((int)value & (int)needState); } state = true; if (inverseCondition == true) { if (result != 0) { state = false; } } else { if (result == 0) { state = false; } } } else { state = true; if (object.Equals(needState, value) == !inverseCondition) { state = false; } } } } } else { state = true; } return(state); }