public static bool BehaviourPropertyIsVisible(MonoBehaviour behaviour, string propertyName, DrawIfBaseAttribute appliedAttribute) { if (string.IsNullOrEmpty(appliedAttribute.fieldToCheck)) { return(true); } var so = new SerializedObject(behaviour); var property = so.FindProperty(propertyName); var targetProperty = ConditionalFieldUtility.FindRelativeProperty(property, appliedAttribute.fieldToCheck); return(ConditionalFieldUtility.PropertyIsVisible(targetProperty, appliedAttribute.inverse, appliedAttribute.compareValues)); }
private void Initialize(SerializedProperty property) { if (instance == null) { instance = base.attribute as DrawIfBaseAttribute; } if (instance == null) { return; } if (!conditionalToTarget.ContainsKey(property)) { conditionalToTarget.Add(property, ConditionalFieldUtility.FindRelativeProperty(property, instance.fieldToCheck)); } if (customDrawersCached) { return; } if (typesCache == null) { typesCache = AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes()) .Where(x => typeof(PropertyDrawer).IsAssignableFrom(x) && !x.IsInterface && !x.IsAbstract); } if (HaveMultipleAttributes()) { multipleAttributes = true; GetPropertyDrawerType(property); } else if (!fieldInfo.FieldType.Module.ScopeName.Equals(typeof(int).Module.ScopeName)) { specialType = true; GetTypeDrawerType(property); } customDrawersCached = true; }