-
Notifications
You must be signed in to change notification settings - Fork 325
Save Game support
Feature available since version 1.1.
Flow Graph simply 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 theUFlowSaveGameobject which simply extends the engine'sUSaveGame. That allows you to easily integrate Flow Graph into your SaveGame setup. -
UFlowSubsystemkeeps a registry of all active Flow Graphs at the given moment. That's why it also contains methods providing SaveGame support. You need to call methods likeOnGameSaved, andOnGameLoaded. These are accessible from blueprints. -
UFlowNodeclass provides overridable eventsOnSaveandOnLoad, so you can custom SaveGame logic to any node, i.e. restore Timer with "RemainingTime" value read from SaveGame. CheckUFlowNode_Timerclass for reference. -
UFlowAssetandUFlowComponentexposes similarOnSaveandOnLoadevents, so you should be able to customize SaveGame logic in every plugin's class that's involved in SaveGame operations.
You can find a quick example of integrating Flow into your SaveGame setup in the FlowSolo demo project. Here's 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. However, in this case, you need to support Save/Load logic a bit on your own.
- You might need to call
UFlowSubsystem::LoadRootFlowon this custom owner (not including Flow Component) 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
bWorldBoundproperty on your Flow Asset to False.
Got any questions? Discuss things related to the plugin on the dedicated Discord server.