A demo project for the UBSaveSystem plugin. The plugin is required to compile the demo project
- Automatic save backups: Every time the game is saved, a backup is created and will be used if the latest save can't be loaded. The amount of backups can be changed in the project settings
- Easy saving/loading with multiple callbacks via an interface:
- Pre Loaded: A callback for when loading save data is about to start
- Post Loaded: A callback for when the save data was loaded (includes a reference to the save data)
- Pre Saved: A callback for when saving the data is about to start. This allows you to update information in the save data before saving
- Post Saved: A callback for when the save data was updated/saved (includes a reference to the save data)
- Save Game Deleted: A callback for when the save data is deleted. This allows you to reset actors to their default state if needed
- Checkpoint system: All variables from actors that are marked as SaveGame will automatically be saved (either to the save game file or in-memory). The values will automatically be restored when loading the game or can be manually saved/restored for specific actors. There's also a function to clear the checkpoint data
- Multiple save slots: The plugin supports multiple save slots with their own backups and checkpoints
- Full Blueprint and C++ support
* All these features are built on top of the Unreal Engine save system and can be integrated into existing projects without rewriting a lot of code
- The UnrealBits Save System Plugin
- Unreal Engine 5.0 or newer
- Download the latest version of the plugin
- Create a plugin folder in the root of your project
- Copy the UBSaveSystem folder to the plugin folder in your project
- Restart Unreal Engine
- Click on Edit > Plugins
- Make sure the plugin is enabled
You can access the plugin settings underneath the project settings. After enabling the plugin, you should see a new UnrealBits section in the project settings. The follow settings can be changed:
Automatically Save Actor Properties:The plugin can automatically save variables from actors whenever you save the game. These values will automatically be applied whenever you load the game. You can use this setting to include the values in the save game, keep them in memory or disable the feature (you can still manually save/load the data even if this is disabled)Save Game Name:The name of the save game filesMax Save Backups:The amount of backups to keep when saving the game
The plugin requires that you use the UnrealBitsSaveGame as the base class for all your save games. This is based on the standard USaveGame class and you should be able to just change the parent class on your existing save games. The only difference is the ActorProperties field which is used for checkpoints
The plugin includes an UnrealBitsSaver interface. This is used to notify actors whenever the game is saved/loaded. This interface is also used automatically save/load variables for actors that implements the interface. The following functions are available:
GetUniqueId:Returns an ID for the actor. This value is used to save/load all specified variables for the actor. You don't need to override this function. If it returns an empty string, then the path name of the actor in the level will be used. Overriding this function allows you to save/restore checkpoints across multiple levelsOnSaveGamePreLoaded:This function is called before the game is loaded. This can be used to display a saving widget or change something in the world while the game is savedOnSaveGamePostLoaded:This function is called after the game is loaded. It includes a reference to the latest save gameOnSaveGamePreSaved:This function is called before the game is saved. It includes a reference to the latest save game. You can also return an updated version of the save game if you want to change some values. Returning an updated save game is optionalOnSaveGamePostSaved:This function is called after the game is saved and allows you to update the state of the actor based on the values from the save game. A reference to the updated save game is includedOnSaveGameDeleted:This function is called after the save game is deleted and allows you to reset the state of the actor if needed
You can save the game by calling the static SaveGame function inside the USaveManagerUtils class. You are required to pass in a world context (C++ only), the UnrealBitsSaveGame, the index of the save slot and a user index integer. This will automatically create a checkpoint (if enabled in the project settings), create a backup of the previous save file and notify all actors implementing the UnrealBitsSaver interface
You can load the game by calling the static LoadGame function inside the USaveManagerUtils class. You are required to pass in a world context (C++ only), the index of the save slot and a user index integer. You can also enable/disable notifying actors about this process by setting the NotifyLoad flag
Checkpoints are automatically saved/loaded whenever you save/load the game (if enabled in the project settings). But you can also manually handle checkpoints if you prefer
Checkpoints can be kept in memory and be excluded from the save file. You can manually save/load checkpoints by calling the static SaveActorPropertiesToMemory and LoadActorPropertiesFromMemory functions inside the USaveManagerUtils class. Both of these function only require a reference to the actor. In-Memory checkpoints can be deleted by calling the static DeleteActorPropertiesFromMemory function inside the USaveManagerUtils class
Checkpoints can also be included in the save game. You can manually save/load checkpoints by calling the static SaveActorPropertiesToFile and LoadActorPropertiesFromFile functions inside the USaveManagerUtils class. Both of these function require a reference to the actor and the UnrealBitsSaveGame which should be updated
Variables can automatically be included in the checkpoint data:
- Make sure you've implemented the
UnrealBitsSaverinterface in the actor - Select the variable you want to include
- Expand the Advanced section in the details panel
- Enable the SaveGame flag
- Clone the project
- Add the plugin to the project (check the Setup section for a step-by-step guide on how to add the plugin)
- Open the project
The demo project includes a basic level that showcases the In-Memory checkpoint system. This covers saving data, loading data, tracking variables and deleting save data
If you need any help integrating the plugin or find any bugs, please let us know at officialunrealbits@gmail.com