File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -170,13 +170,15 @@ public bool TryGetCollectionsOfItemType<T>(out List<ScriptableObjectCollection<T
170170 return false ;
171171 }
172172
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
174174 {
175175 List < T > result = new List < T > ( ) ;
176+ Type targetType = typeof ( T ) ;
176177 for ( int i = 0 ; i < collections . Count ; i ++ )
177178 {
178179 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 ) ) )
180182 result . Add ( ( T ) scriptableObjectCollection ) ;
181183 }
182184
You can’t perform that action at this time.
0 commit comments