Using Subsystems for a "GridManager" class?

Daniel (Cxyda)
Fri, 12 Jan 2024 23:38:32 +0000
C++

Hey there, I’m new to Unreal and C++ so sorry if my question is unusual or just stupid.
I’m working on a Game which has several Grids (c++). The grid class is a C++ class based on the Actor class.

I just started that project so I thought just to create a Singleton GridManager class which can return the Grid I’m looking for by ID but then I stumbled uppon the Subsystems, I read that It has some advantages compared to Singletons so i wanted to give them a try.
I created a Subsystem based on UGameInstanceSubsystem.

Now I’d like to create instances of my Grid class in my Subsystem::Initialize() but since I cannot create a Blueprint class from my Subsystem I’m unable to assign a Grid class to it to spawn that grid right? My Grid class has several TSubclassOf<> references which need to be assigned.

Is there a way to solve this? Or is a subsystem not meant to do such things and should not / can not such World Object related things?

Thanks a lot in advance!
Cxyda

6 posts - 3 participants