Which Unreal class should I use for a general container for my own classes in-game?

Hi!

I am developing a project in which there will be different pawns (based on Pawn class), static and dynamic actors, all (based on the Actors class). I want to create my own search mechanism and implement a container that will be a class with different containers per type and per area.

However, I am not sure how to implement this. At first, I thought about creating a game element in the scene that can be searched from other elements like pawns or actors. Later, I considered using a UObject as a class base.

The problem with using UObject is that it cannot be directly placed into the scene. Therefore, I am considering creating an instance of this class in the GameMode C++ because I do not need to create a scene element, and it can be accessed through all agents via UGameplayStatics::GetGameMode. However, I am unsure if it’s the best idea to have it in the GameMode code.

What do you think? What would be the best solution in this case?

Thanks!

To be honest I did not completely understand what you are trying to achieve, but could a (GameInstance) Subsystem help in your case?

Yes! After some research I think that could be a good solution. I’ve never made a subsystem in Unreal, but tomorrow I’ll try.
I tried to do a Singleton, but i had some problems with the engine… Maybe i did it wrong, but subsystem seems to fit better.