Saving Your Game with Blueprints

How to save and load your game using Blueprints


Create a SaveGame Object

To create a new SaveGame object, create a new Blueprint Class. When the Pick Parent Class dialog pops up, expand the Custom Classes dropdown, then select SaveGame. You can use the search box to jump directly to SaveGame. Name your new blueprint MySaveGame.


In your new SaveGame object Blueprint, create variables for any information you would like to save.

In this example, there are also variables declared that will be used to store default values for the SaveSlotName and the UserIndex, so that each class that saves to this SaveGame object will not have to independently set those variables. This step is optional, and will cause there to be one save slot that gets overwritten if the default values are not changed.


You can set default values for the variables after the Blueprint is compiled.

Saving a Variable

This is a snapshot of the entire saving setup. You can click the image to enlarge it.

First, create an instance, or copy, of your SaveGame object, using the Create Save Game Object node. Make sure you set the Save Game Class dropdown to the name of your new Blueprint, in this case, MySaveGame. The Create Save Game Object node will automatically change its output pin type to match the type you specify with the Save Game Class input, enabling you to use it directly, without a Cast To node. Save the resulting object to a variable by using Promote to Variable so that you can reuse the MySaveGame object you just created later on.


Now that you have a copy of your custom SaveGame object, MySaveGame, saved to the Save Game Instance variable, you can send information to it. Here, the Player Name is being set to "PlayerOne". You would repeat this step for any other variables you wanted to store information in.


Now, you can use the Save Game To Slot node to save the SaveGame object's information to the hard drive. The Save Game To Slot node takes in a file name and a user ID, which in this case, are the default values created earlier.


Loading a Variable

This is a snapshot of the entire saving setup. You can click the image to enlarge it.

This first step is optional, and is based on saving a default save slot and user ID within the SaveGame object. Here, an empty SaveGame object is first created, so the default SaveSlotName and UserIndex can be read from it. Again, this may not apply in all game implementations.


You can use the Load Game From Slot node to create an instance of your SaveGame object Blueprint. A Cast To node will be needed to treat the resulting object as a MySaveGame, which you will want to do so that you can store it in a variable for easy access later.


Once the new SaveGame object has been loaded from the hard drive, the variable values can be read from it and assigned to the necessary Actors or classes, or used directly as shown here.


Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback