Data Assets
Data Assets let you keep typed story data in .sfd files. Export your project from StoryFlow Editor, then import it into Unreal to use those values in dialogue and game code.
Importing Data Assets
The editor writes data-assets.json with the project export. Import the whole export folder so the plugin can create the corresponding UStoryFlowDataAssetAsset assets and connect their parent relationships. Data Assets referenced only by game code are included too.
In Blueprint, use Find Data Asset on the StoryFlow Subsystem with a Data Asset ID or display name. A name shared by more than one asset cannot identify one reliably, so use its ID in that case. You can also select an imported Data Asset asset directly on the typed accessor nodes.
Reading and Writing Values
Both UStoryFlowSubsystem and UStoryFlowComponent expose matching typed accessors. Enter the variable name as it appears in StoryFlow Editor. Check bFound on reads and the boolean return value on writes. A type mismatch or unknown variable does not produce a usable value.
UStoryFlowSubsystem* StoryFlow = GetGameInstance()->GetSubsystem<UStoryFlowSubsystem>();
UStoryFlowDataAssetAsset* Quest = StoryFlow->FindDataAsset(TEXT("Quest"));
if (Quest)
{
bool bFound = false;
const int32 Progress = StoryFlow->GetDataAssetIntVariable(Quest, TEXT("Progress"), bFound);
if (bFound)
{
StoryFlow->SetDataAssetIntVariable(Quest, TEXT("Progress"), Progress + 1);
}
} Use the Bool, Int, Float, String and Enum accessors for scalar values. The String accessor also serves image, audio and character variables, whose values are stored as strings. GetDataAssetVariableNames returns declared names from the parent chain, starting with the root asset.
Arrays and Maps
Use GetDataAssetVariantVariable for arrays and maps. In Blueprint, pass the result to the StoryFlow Variant Library's Get Variant Array or Get Variant Map node. The map reader provides parallel key and value arrays. For writes, use SetDataAssetArrayVariable with an array of variants or SetDataAssetMapVariable with parallel key and value arrays. The declared container and element types must match. Empty arrays and maps are valid writes.
Enum map keys use String variants: construct them with Make Variant From String. Enum values use Make Variant From Enum. Passing an Enum variant as a map key causes the write to fail.
Variant Values
The StoryFlow Variant Library also provides typed readers and Make Variant From nodes for constructing array elements and map entries in Blueprint. See the API Reference for the available functions.
Inheritance and Saves
A read finds the nearest value on the asset's parent chain, including authored overrides and values changed during this play session. A write belongs to the Data Asset you pass in and can affect descendants that have not overridden that value. ResetDataAssetOverlay clears session writes and restores authored values.
The plugin includes session writes in its save slots. It does not change the source Data Asset in your Unreal project. When you import a revised export, check your game logic for renamed or removed variables.