Skip to content

Commit

Permalink
fix: implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
brunomikoski committed Sep 4, 2023
1 parent 6a36c66 commit fba8180
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Scripts/Runtime/Core/CollectionsRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,15 @@ public bool TryGetCollectionsOfItemType<T>(out List<ScriptableObjectCollection<T
return false;
}

public bool TryGetCollectionsOfType<T>(out List<T> inputActionMapCollections) where T : ScriptableObjectCollection
public bool TryGetCollectionsOfType<T>(out List<T> inputActionMapCollections, bool allowSubclasses = true) where T : ScriptableObjectCollection
{
List<T> result = new List<T>();
Type targetType = typeof(T);
for (int i = 0; i < collections.Count; i++)
{
ScriptableObjectCollection scriptableObjectCollection = collections[i];
if (scriptableObjectCollection.GetType() == typeof(T) || scriptableObjectCollection.GetType().IsSubclassOf(typeof(T)))
Type collectionType = scriptableObjectCollection.GetType();
if (collectionType == targetType || (allowSubclasses && collectionType.IsSubclassOf(targetType)))
result.Add((T)scriptableObjectCollection);
}

Expand Down

0 comments on commit fba8180

Please sign in to comment.