Recommendation
Use Game Instance for temporary state that spans map loads. Use SaveGame for data that must survive closing the game.
Compare the options
Game Instance
Choose when
- State lasts for the current application run.
- The value must cross level travel.
- Writing the value to disk is unnecessary.
Tradeoffs
- The state is lost when the process exits.
- Each machine has its own non-replicated instance.
- Blueprint
- Use Get Game Instance or a Game Instance Subsystem.
- C++
- Use UGameInstance or UGameInstanceSubsystem.
SaveGame
Choose when
- Progression, settings, unlocks, or checkpoints persist between sessions.
- The player can quit and resume later.
Tradeoffs
- The project owns serialization, versioning, slots, and error handling.
- Large saves should use asynchronous operations during active play.
- Blueprint
- Create a SaveGame Blueprint and use Create Save Game Object, Async Save Game to Slot, and Async Load Game from Slot.
- C++
- Derive from USaveGame and use UGameplayStatics::AsyncSaveGameToSlot and AsyncLoadGameFromSlot.
Requirements
Both systems are built into Engine. Save data needs a slot strategy and a plan for format changes.
Example
Keep the current party pending travel destination in Game Instance. Store campaign checkpoints in SaveGame.