-
Notifications
You must be signed in to change notification settings - Fork 241
Save Game support
Intial SaveGame support is available since version 1.1.
Flow Graph plugs into Unreal's SaveGame
system. If you haven't used it yet, read "Saving and Loading Your Game" docs.
You control which properties are included in SaveGame by marking C++ properties with the SaveGame
specifier. Or by ticking the SaveGame
checkbox in the blueprint editor.
-
FlowSave.h
. Active graphs are serialized to theUFlowSaveGame
object which simply extends the engine'sUSaveGame
. That allows you to integrate Flow Graph into your SaveGame setup easily. -
UFlowSubsystem
keeps a registry of all active Flow Graphs at the given moment. That's why it also contains methods providing SaveGame support. To support Flow Graph in your save system, you need to call methodsOnGameSaved
,OnGameLoaded
. These are accessible from blueprints. -
UFlowNode
class provides overridable eventsOnSave
andOnLoad
, so you can add custom SaveGame logic to any node, i.e. restore Timer with "RemainingTime" value read from SaveGame. CheckUFlowNode_Timer
class for reference. -
UFlowNode_Checkpoint
node is a built-in example of implementing autosave called from quests. -
UFlowAsset
andUFlowComponent
exposes similarOnSave
andOnLoad
events, so you should be able to customize SaveGame logic in every plugin's class that's involved in SaveGame operations.
Signal Modes features provides a solution for modifying Flow Graphs post-launch, once players already have SaveGames with serialized graph state.
You can find a quick example of integrating Flow into your SaveGame setup in the FlowSolo
demo project. Here are simple C++ classes related to this.
Note: You might need to call UFlowSubsystem::LoadRootFlow
manually on your Root Flow owners if you're loading a game while the world is already active. Flow Component does automatically call LoadRootFlow
only on BeginPlay! Supporting in-game loading is up to you.
It's possible to create Root Flow for any UObject owner, i.e. Player Controller or some subsystem. If these objects don't include Flow Component, supporting Save/Load logic requires a bit more work.
- You need to call
UFlowSubsystem::LoadRootFlow
on this custom owner after deserializing SaveGame withUFlowSubsystem::OnGameLoaded
. Look at the sample code linked above, you need to iterate on owners if they don't include Flow Component's logic. - If your Root Flow is created on UObject owner that doesn't belong to the world (Game Instance or its subsystem), you need to set the
bWorldBound
property on your Flow Asset to False.
Got any questions? Discuss things related to the plugin on the dedicated Discord server.