public static void GetAttributes(SerializedProperty property, FieldInfo fieldInfo, out List <CombinablePropertyAttribute> outAttributes) { if (!_cachedAttributes.TryGetValue(fieldInfo, out outAttributes)) { outAttributes = new List <CombinablePropertyAttribute>(); foreach (object o in fieldInfo.GetCustomAttributes(typeof(CombinablePropertyAttribute), true)) { CombinablePropertyAttribute combinableProperty = o as CombinablePropertyAttribute; if (combinableProperty != null) { if (combinableProperty.SupportedTypes.Count() != 0 && !combinableProperty.SupportedTypes.Contains(property.propertyType)) { Debug.LogError("Property attribute " + combinableProperty.GetType().Name + " does not support property type " + property.propertyType + "."); continue; } outAttributes.Add(combinableProperty); } } _cachedAttributes[fieldInfo] = outAttributes; } }
private void getAtrributes(SerializedProperty property) { attributes.Clear(); foreach (object o in fieldInfo.GetCustomAttributes(typeof(CombinablePropertyAttribute), true)) { CombinablePropertyAttribute combinableProperty = o as CombinablePropertyAttribute; if (combinableProperty != null) { if (combinableProperty.SupportedTypes.Count() != 0 && !combinableProperty.SupportedTypes.Contains(property.propertyType)) { Debug.LogError("Property attribute " + combinableProperty.GetType().Name + " does not support property type " + property.propertyType + "."); continue; } attributes.Add(combinableProperty); } } }