Skip to content

Commit fba8180

Browse files
committed
fix: implementation
1 parent 6a36c66 commit fba8180

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Scripts/Runtime/Core/CollectionsRegistry.cs

+4-2
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)