public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { if (attribute._fieldOrProp == null) { var field = ReflectionKit.GetFieldInfo(property.serializedObject.targetObject, attribute._name); if (field?.FieldType == typeof(bool)) { attribute._fieldOrProp = field; } else { var prop = ReflectionKit.GetPropertyInfo(property.serializedObject.targetObject, attribute._name); if (prop?.PropertyType == typeof(bool) && prop.CanRead) { attribute._fieldOrProp = prop; } } } object result = (attribute._fieldOrProp as FieldInfo)?.GetValue(property.serializedObject.targetObject); if (result == null) result = (attribute._fieldOrProp as PropertyInfo)?.GetValue(property.serializedObject.targetObject, null); if (result != null) { if ((bool)result == attribute._value) { attribute._result = 0; return -2f; } else { attribute._result = 1; return base.GetPropertyHeight(property, label); } } else { attribute._result = -1; return EditorGUIUtility.singleLineHeight; } }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { if (attribute._fieldOrProp == null) { var field = ReflectionKit.GetFieldInfo(property.serializedObject.targetObject, attribute._name); if (field?.FieldType == typeof(bool)) { attribute._fieldOrProp = field; } else { var prop = ReflectionKit.GetPropertyInfo(property.serializedObject.targetObject, attribute._name); if (prop?.PropertyType == typeof(bool) && prop.CanRead) { attribute._fieldOrProp = prop; } } } return attribute._fieldOrProp == null ? EditorGUIUtility.singleLineHeight : base.GetPropertyHeight(property, label); }