-
Notifications
You must be signed in to change notification settings - Fork 0
Step 10: Persistent & Custom Objects
Not everything lives on an actor. Quest logs, world flags, profile settings - any UObject with SaveGame variables can be saved under a key, without a Saveable Component.
Register Custom Object (Key, Object) saves the object's SaveGame variables inside the current slot. Different slots hold different values. Use it for anything that is part of one playthrough:
- Quest log / story progress
- World flags ("bridge destroyed", "merchant unlocked")
- Game-mode state that has no actor
Register Persistent Object (Key, Object) saves the object's SaveGame variables in a shared file that every slot sees. Use it for things that must survive slot changes:
- Player profile (name, total play time)
- Unlocks and achievements progress
- Anything a "New Game" should NOT reset
Register once, early - Game Instance Init is the natural place. Registration is sticky: every save captures the object, every load restores it.
Game Instance > Event Init
-> Register Custom Object (Key: "QuestLog", Object: QuestLog ref)
-> Register Persistent Object (Key: "Profile", Object: Profile ref)
Registering after a load is also safe: if the slot already contains data for that key, it is applied to the object immediately.
Unregister only when the object should stop being saved (rare) - objects do not need to be unregistered on shutdown.
- Keys are FNames; keep them stable across versions (they are your data's identity).
- The data lives in a sidecar next to the slot file (
.global), so world data and object data never corrupt each other. - Multiplayer: registration and restore happen on the server, like everything else.
Next: Step 11: Save Versions & Migration