Download

vanilla c++ class object as a game instance member?

I’m assuming this is a bit of a noob question. I need to store a fair bit of data persistantly, a procedually generated map for a space RTS (star systems filled with stars,planets,asteroids etc). I’ve tried adding regular classes from c++ to the game instance class in VS but not had any success. Is this even something that is possible, or am I probably making some schoolboy error?

Hi lagrange gormo,

I’m not sure I exactly understand what you’re trying to accomplish. Are you trying to save game data from between one map/level to the next? Are you trying to save information to be used in the next game session? (Closing the game and opening it back up)

Either one of these, I’d recommend looking into how to set up saving/loading in UE4:
Saving and Loading Your Game | Unreal Engine Documentation for more of a pseudocode approach
[UE4 Tutorials Series] - 003 - Save & Load game data - Community Content, Tools and Tutorials - Unreal Engine Forums this contains a video of someone setting up a saving/loading system in blueprints, but should be easy to translate to code.

If you still need help doing what you’re trying to do, please let me know.

Have a nice day,
Matthew Clark