Cooking Data for Packaged Builds
A key feature of the FactsDB system is its separation between the flexible development environment and the optimized, packaged game. To ensure performance, fast load times, and reliable data in your shipped build, FactsDB uses a cooking process.
Why Cooking Is Required
In the editor, the system favors flexibility:
- Dynamic Data:
UFactSchemaManager
andUFactQueryManager
load directly fromUDataTable
andUFactsDBQueryDefinition
assets. - Live Updates: Changes to data assets are reflected instantly.
- On-Demand Inheritance: Schema inheritance is resolved during runtime.
This dynamic approach is ideal for iteration but inefficient for shipping. The cooking process transforms multiple live assets into a single, optimized, preprocessed data source.
Benefits of Cooking:
- Performance: Eliminates the need to load and parse multiple assets at runtime.
- Efficiency: Combines schema and query data into a single compact
UPrimaryDataAsset
, reducing load times and memory usage. - Reliability: Includes validation to catch issues like circular dependencies or duplicate tags at build time.
The Cooked Data Asset
The result of the cooking process is a single UFactsDBRuntimeData
asset containing:
CookedSchemaData
: Fully resolved schemas with inheritance flattened and defaults applied.CookedQueryData
: All query definitions with references resolved.
In a packaged build, this asset becomes the only data source used by FactsDB.
How to Cook
You must trigger the cooking process manually before building your game.
- Open Project Settings > Project > FactsDB Cooking Settings.
- In the Cooking Actions section, select Cook FactsDB Data.
The process performs:
- Validation – Ensures all schema and query definitions are correct. Build fails if errors are found.
- Data Consolidation – Gathers all defined schemas and queries.
- Resolution – Resolves inheritance and references using the managers.
- Asset Generation – Creates or updates the
UFactsDBRuntimeData
asset at the configured path. - Serialization & Save – Writes the finalized data into the asset for use at runtime.
Configuration
In FactsDB Cooking Settings, you can configure:
-
Cooked Data Asset Path
Location where the cooked asset will be saved (e.g.,/Game/FactsDB/Data/DA_FactsDBRuntimeData
). Must be a valid package path. -
Use Cooked Data
false
(unchecked): (Default in development) Uses live, uncooked data.true
(checked): (Required for packaged builds) Loads only the cooked asset. If the asset is missing, the game will fail to initialize.
This image shows a preview of the resulting UFactsDBRuntimeData
asset after cooking. It contains the resolved schema and query data and is the single source of truth for FactsDB during runtime in packaged builds.
Runtime Usage
In a cooked build (Use Cooked Data = true
), UFactRuntimeSubsystem
bypasses the editors and directly loads UFactsDBRuntimeData
. It passes this to a lightweight FFactsDBRuntimeDataProvider
that performs fast lookups using the cooked maps, ensuring optimal performance.
Next Up: FAQ & Troubleshooting