What is the best way to keep data between levels?

I am working on a game where the player goes through various levels and quests to increase stats, but I can’t figure out the best way to keep the data between the levels. It seems strange to me that there isn’t some class that is persistent between levels that I can subclass to store data in. Currently I change levels using:

GetWorld()->ServerTravel(MapToPlay, false, false);

From what I have read so far, the two main options are:

  1. Save the entire state of the game between each level, then reload it. This is guaranteed to work but isn’t trivial.

  2. Someone suggested I put data in the LocalPlayer PlayerController. This seems a bit messy to me, and is it guaranteed to work in all circumstances?

Is there a better way?

#Config Files

For very small amount of data you can simply save it out to config file and then load it back

#Binary Save and Load

I have tutorial on how to save any data you want to compressed binary file and then load it back into the game!

:slight_smile:

Thanks , your tutorial is exactly what I’m using for loading/saving :slight_smile:

Just want to say here the ways:

  1. Use level streaming and the game/state mode will not change.
  2. Use the Game Instance, it don’t change between levels. You need to reset it if you leave to the main menu.
  3. Use Save Game