How to save variables

In this tutorial we will save and load an integer variable, to make it simple. There aren’t many tutorials on how to save/load anything in a multiplayer environment in Unreal, so I decided to write one, it should be transferable to FPS and TSS game starter kits too, as they all use the same principles (base class, child classes, etc.)

Open the player controller and create custom events for saving and loading, add Load on Begin Play after it sets the player cast variable, call the SaveGame event when you want to save a variable

On the character class, make also custom events that do the usual Server/Client and replicated variables stuff, in this example increasing an integer was used as an example.

Essentially what is happening here is that the client uses a local save file, but when it loads it, the event that runs on the server gets called, and updates the value. With this in mind, any other variable can be get/set.

If there is demand for more examples, I will update this page, but this should give you a basic understanding of saving and loading variables in Unreal Engine.

For questions and suggestions feel free to contact me here.