@@ -94,10 +94,23 @@ public List<SerializedProperty> GetPropertiesOfClass(SerializedObject so, List<T
94
94
return properties ;
95
95
}
96
96
97
- public void ShowPropertiesOfClass ( string title , SerializedObject so , List < Type > attributeClasses , bool addSpace = true )
97
+ public void ShowPropertiesOfClass ( string title , SerializedObject so , List < Type > attributeClasses , bool addSpace = true , List < Type > excludeAttributeClasses = null )
98
98
{
99
99
// display a property if it belongs to a certain class and/or has a specific attribute class
100
100
List < SerializedProperty > properties = GetPropertiesOfClass ( so , attributeClasses ) ;
101
+ if ( excludeAttributeClasses != null )
102
+ {
103
+ List < SerializedProperty > excludeProperties = GetPropertiesOfClass ( so , excludeAttributeClasses ) ;
104
+ List < SerializedProperty > removeProperties = new List < SerializedProperty > ( ) ;
105
+ foreach ( SerializedProperty excprop in excludeProperties )
106
+ {
107
+ foreach ( SerializedProperty prop in properties )
108
+ {
109
+ if ( prop . displayName == excprop . displayName ) removeProperties . Add ( prop ) ;
110
+ }
111
+ }
112
+ foreach ( SerializedProperty prop in removeProperties ) properties . Remove ( prop ) ;
113
+ }
101
114
if ( properties . Count == 0 ) return ;
102
115
if ( title != "" ) EditorGUILayout . LabelField ( title , EditorStyles . boldLabel ) ;
103
116
foreach ( SerializedProperty prop in properties )
@@ -141,7 +154,7 @@ public Attribute GetPropertyAttribute(SerializedProperty prop, Type attributeCla
141
154
{
142
155
foreach ( Attribute attr in fieldInfo . GetCustomAttributes ( attributeClass , true ) )
143
156
{
144
- if ( attr . GetType ( ) == attributeClass )
157
+ if ( attributeClass . IsAssignableFrom ( attr . GetType ( ) ) )
145
158
return attr ;
146
159
}
147
160
}
0 commit comments