Set properties of Game Instance Subsystem to Blueprint classes

Hi!

I’m using Unreal 5.4.2.

I need to spawn a blueprint class from C++ and I don’t know how to do it. I have this code:

UCLASS()
class TETRIS_API UTGamePlayGameInstanceSubsystem : public UGameInstanceSubsystem
{
	GENERATED_BODY()

public:
	UPROPERTY(EditInstanceOnly)
	TSubclassOf<AActor> AssignPuzzleSampleActor;
	
	UPROPERTY(EditInstanceOnly)
	TSubclassOf<AActor> SumPuzzleSampleActor;
	
	UPROPERTY(EditInstanceOnly)
	TSubclassOf<AActor> SubPuzzleSampleActor;

	void StartTetrisGame();

private:
	void SpawnPuzzleToSolve(EPuzzleToSolve PuzzleToSolve);
	
};

If I want to call the method StartTetrisGame() from C++, I don’t know how to do it think I have to create a blueprint subclass of UTGamePlayGameInstanceSubsystem to be able to set the three UPROPERTY to a Blueprint class. Or at least assign their value from blueprint.

How can I do it?

I need to set these values:

	UPROPERTY(EditInstanceOnly)
	TSubclassOf<AActor> AssignPuzzleSampleActor;
	
	UPROPERTY(EditInstanceOnly)
	TSubclassOf<AActor> SumPuzzleSampleActor;
	
	UPROPERTY(EditInstanceOnly)
	TSubclassOf<AActor> SubPuzzleSampleActor;

Which are Blueprint classes, before I call void StartTetrisGame(); from C++.

Maybe I can hard code their values, or use a different approach.

Currently, blueprint subtypes of subsystems aren’t supported.

There are three approaches that are currently common to solve this sort of thing:

The first option is to use the “Config” markup on the UCLASS and UPROPERTY’s. Then you can specify those types by editing the ini you specify with the UCLASS markup.

The second option option is to create a class derived from UDeveloperSettings. You’ll have to do all the same config markup (since that’s how the values would be saved). You’ll also want to use the “DefaultConfig” UCLASS markup in this case.

The main difference between the two is that the Developer Settings option gives you an in-Editor UI for modifying the values so it can be easier to set them or for others to edit/update them.

The last option is to create an AActor derived type that you place in maps and configure with the values. Admittedly this shouldn’t really be necessary for a Game Instance Subsystem, but is a good option for many of the subsystems that are only spawned in Worlds (World Subsystem, Local Player Subsystem, etc). I mention it here more for completeness than anything else.