private void Initialize(SerializedProperty property) { if (!_conditionalToTarget.ContainsKey(property)) { _conditionalToTarget.Add(property, ConditionalFieldUtility.FindRelativeProperty(property, Conditional.FieldToCheck)); } if (_customDrawersCached) { return; } if (_allPropertyDrawerAttributeTypes == null) { _allPropertyDrawerAttributeTypes = 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 != null && !fieldInfo.FieldType.Module.ScopeName.Equals(typeof(int).Module.ScopeName)) { _specialType = true; GetTypeDrawerType(property); } _customDrawersCached = true; }
private static bool ExcludeCheckIfConditionalFieldHidden(FieldInfo field, MonoBehaviour behaviour) { if (_conditionallyVisibleType == null) { return(false); } if (!field.IsDefined(_conditionallyVisibleType, false)) { return(false); } // Get a specific attribute of this field var conditionalFieldAttribute = field.GetCustomAttributes(_conditionallyVisibleType, false) .Select(a => a as ConditionalFieldAttribute) .SingleOrDefault(); return(conditionalFieldAttribute != null && !ConditionalFieldUtility.BehaviourPropertyIsVisible(behaviour, field.Name, conditionalFieldAttribute)); }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { Initialize(property); _toShow = ConditionalFieldUtility.PropertyIsVisible(_conditionalToTarget[property], Conditional.Inverse, Conditional.CompareValues); if (!_toShow) { return(0); } if (_genericAttributeDrawerInstance != null) { return(_genericAttributeDrawerInstance.GetPropertyHeight(property, label)); } if (_genericTypeDrawerInstance != null) { return(_genericTypeDrawerInstance.GetPropertyHeight(property, label)); } return(EditorGUI.GetPropertyHeight(property)); }