[SOLVED]Making Blueprint of UGameInstanceSubsystem

How Can I create a blueprint of UGameInstanceSubsystem and make sure that only the blueprint one is initialized? Currently, on making the blueprint both are getting initialized.

Issue - I need to expose a Tmap for the game editor which the user will configure. I use this in my plugin.


UMySubSystemManager* MySubsystem = GetWorld()->GetGameInstance()->GetSubsystem<UMySubSystemManager>();

How can I ensure I use the child of this class i.e the blueprint and not the cpp.

Bump any help : (

Hi,

so the basic concept is that Blueprints build on top of C++ code. This also means that C++ Does not know anything about blueprints. To work around that you normally have to declare a function in C++ and implement it in Blueprints.
Regarding your questing: I am not sure if you can create a Blueprint from a Subsystem. But what you could do, is make a setter function which will actively set the TMap in your MySubsystem. And this could be everywhere, like an Actor in the level who will do this on begin play.

Best
Dominic



UClass* Class = MySubsystem->GetClass();
UBlueprint* BP = Cast<UBlueprint>(Class->ClassGeneratedBy);


BP will be nullptr if it isn’t a blueprint.
But that doesn’t solve the problem, your native class should be marked with Abstract specifier.



UCLASS(Abstract)


That will prevent the C++ base class to be spawned by the SubsystemCollection{}.

2 Likes

Thanks For the direction but on making abstract C++, sometimes the blueprint of this is also not spawning. But after double-clicking and opening blueprint it starts working : (

Blueprint classes are only loaded when there are hard object references to them or you explicitly load the class with FAssetRegistryModule.

2 Likes

Thanks for the help : )