File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -170,13 +170,15 @@ public bool TryGetCollectionsOfItemType<T>(out List<ScriptableObjectCollection<T
170
170
return false ;
171
171
}
172
172
173
- public bool TryGetCollectionsOfType < T > ( out List < T > inputActionMapCollections ) where T : ScriptableObjectCollection
173
+ public bool TryGetCollectionsOfType < T > ( out List < T > inputActionMapCollections , bool allowSubclasses = true ) where T : ScriptableObjectCollection
174
174
{
175
175
List < T > result = new List < T > ( ) ;
176
+ Type targetType = typeof ( T ) ;
176
177
for ( int i = 0 ; i < collections . Count ; i ++ )
177
178
{
178
179
ScriptableObjectCollection scriptableObjectCollection = collections [ i ] ;
179
- if ( scriptableObjectCollection . GetType ( ) == typeof ( T ) || scriptableObjectCollection . GetType ( ) . IsSubclassOf ( typeof ( T ) ) )
180
+ Type collectionType = scriptableObjectCollection . GetType ( ) ;
181
+ if ( collectionType == targetType || ( allowSubclasses && collectionType . IsSubclassOf ( targetType ) ) )
180
182
result . Add ( ( T ) scriptableObjectCollection ) ;
181
183
}
182
184
You can’t perform that action at this time.
0 commit comments