How do I maintain and use a singleton instance like this that needs to stay alive for the system to work?

I have most of my design worked out, but before I get cracking there’s one last thing I wonder about. I will have a C++ class A that inherits Actor so that it can be spawned in the level. The way this class get its data is via a singleton that acts as a bridge to load data from file. The idea is that the A object calls a function like Bridge::LoadDataFromID(int id), which would then parse data where the ID matches, process some stuff and return data to the A object to do what it want. The mesh of the actor would be stored in the bridge so that a reference is returned; this way the same mesh is reused by several identical actors of the same ID.

I want to expose A to blueprint so that level designers can place actors of class A in the level. The appearance of the item changes based on ID (one mesh for every ID), which means that when the designer changes the ID property of the actor, it should get data (including a mesh reference) from the bridge. I figured this could happen in the construction script or wherever else code executes when the ID property changes. In a game it would be no problem to use the singleton because it would be initialized at game start, but since this happens in the editor, how do I maintain and use a singleton instance like this that needs to stay alive for the system to work?

Also: how are the actors placed in the editor instantiated when the game starts? Are the variable values simply dumped into the map and restored when map loads? Because then the mesh references might not be the same. Ideally I would like to just be able to place A objects into the map using the editor and change ID to see what they would become in game. I don’t care what other values they hold (I don’t even care about the mesh, it will be reloaded), because when the game loads, the instances could be created by passing the ID to the constructor (which would then use the ID to get data from bridge in-game). Position, orientation, scaling and that stuff should of course be kept so that the actor is created at the correct place, I’m just talking about A specific data, which will be reloaded anyways :slight_smile:

There’s a lot of background to this so it’s kind of hard to explain in short, but I hope I get my point across.