private static bool CheckShowTarget(SerializedProperty property, ShowIfAttribute.Target target) { if (target == null) { return(true); } object obj = GetTargetObjectForArray(property, target.name) ?? property.serializedObject.targetObject; return(CheckFieldOrProperty(obj, target)); }
public static bool CheckFieldOrProperty(object targetObject, ShowIfAttribute.Target target) { Type targetObjectType = targetObject.GetType(); FieldInfo fieldInfo = targetObjectType.GetField(target.name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); if (fieldInfo != null) { return(CheckIsUnityObject(fieldInfo.GetValue(targetObject)) == target.show); } PropertyInfo propertyInfo = targetObjectType.GetProperty(target.name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); if (propertyInfo != null) { return(CheckIsUnityObject(propertyInfo.GetValue(targetObject, null)) == target.show); } return(true); }
internal static bool CheckShowTarget(SerializedProperty property, ShowIfAttribute.Target target) { if (target == null) { return(true); } object obj = GetTargetObjectForArray(property, target.name); if (obj == null) { obj = GetTargetObjectChild(property, target.name); } if (obj == null) { obj = property.serializedObject.targetObject; } return(CheckFieldOrProperty(obj, target)); }