FSubsystemCollection doesn't work as I would expect

Bionic_Ape
Sun, 27 Jun 2021 23:11:17 +0000
C++

Hi,

GetSubsystemArray(TSubclassOf) Only works for the first parent.

If I have a USubsystemChild that inherits from USubystemParent that also inherits from UGameInstanceSubsystem, then, when I call TArray<UGameInstanceSubsystem*> Subsystems = GetWorld()->GetGameInstance()->GetSubsystemArray<UGameInstanceSubsystem>(); the instance of USubsystemChild is not there.

My GameInstance's FSubsystemCollection has the SubsystemArrayMap with two entries UGameInstanceSubsystem and USubystemParent, that is one with all the different UGameInstanceSubsystem instances that the first parent is UGameInstanceSubsystem and another list with the subsystem instance that inherits USubystemParent.

From my point of view, USubsystemChild's instance should be included in the list for the map SubsystemArrayMap entry UGameInstanceSubsystem.

The problem that I have is that I need to iterate all UGameInstanceSubsystem to find one that implements an interface.

Does anybody know if this is intended or a bug? also, is there a way to get all subsystems so I can see if they implement an specific interface?

Thanks.

3 posts - 2 participants