12. Store your economy data in your own DataTable
Build this example in your Unreal project and compare the result at each step.
On this page
You will create a row structure that fits your game, read its fields with Unreal’s native nodes, and validate the numbers before distributing the asset.
A. Define the structure and create the table
- Stop Play. In the Content Browser, open Add → Blueprints → Structure and create ST_EconomyRow.
- Add Price and Reward, both of type Scientific Number; Category of type Gameplay Tag; and Label of type String. Configure tags such as
Game.EconomyandGame.Shopin the project’s Gameplay Tags if they do not exist yet. - Under Data, choose Miscellaneous → Data Table. Select ST_EconomyRow as the row structure and name the table DT_MiEconomia.
- In the table editor, create the rows
DefaultsandUpgrade. In the single text field, enter1e3for Defaults.Price,2.5e1for Defaults.Reward,2.5e2for Upgrade.Price, and0for Upgrade.Reward. Choose Category with the Gameplay Tag selector and fill in Label. - Save the table and use its native Export option to export it as CSV and JSON. Keep the exported CSV as a template: Unreal writes the row header and exact Gameplay Tag serialization. If you edit Price in the file, change only that cell and use Import or Reimport in the table editor. Review the data and save the changes.
What you should see: two rows with your four fields. Defaults.Price represents 1000, Defaults.Reward represents 25, and Upgrade.Price represents 250. The structure is yours: you can change names, add more FScientificNumber fields, or include them in nested structures and containers.
When editing the CSV: for this exercise, open it in Notepad++ or another text editor and keep a copy of the original export. Change only the number inside (Base=...,Exponent=...). Preserve commas and quotes: doubled quotes inside a quoted field, such as ""Game.Economy"", are required. If a spreadsheet opens everything in one column, do not save it that way: import using a comma delimiter and check the columns before exporting. If Unreal reports Too few cells on row, correct the CSV and reimport before saving the table.
B. Read a row with Unreal’s native nodes
- Create an Actor Blueprint called BP_MiTabla and place an instance in the level. In My Blueprint, create a variable Tabla of type Data Table Object Reference and another variable Fila of type Name. Compile; then assign
DT_MiEconomiato Tabla andDefaultsto Fila in Class Defaults. - In Event Graph, connect execution from Event BeginPlay to the execution input of Get Data Table Row. Connect Tabla to the Data Table pin and Fila to the Row Name pin.
- Connect Out Row to Break ST_EconomyRow. Connect Price to Value on To Fixed String and its Return Value to In String on Print String. Use Decimal Places = 2. Connect execution from Row Found to the execution input of To Fixed String, and its execution output to Print String. Do not add a Branch for Row Found.
- Connect the Row Not Found execution pin to another Print String with
Row Defaults was not found. - Compile, save, and press Play.
Expected result: 1000.00 is printed. Change Fila to Upgrade and repeat: 250.00 appears. Try FilaInexistente: the Row Not Found path runs and no number is printed as valid.
C. Pass the field to a Safe component
- In your wallet Actor, check that Wallet is a Scientific Number Safe Value Component.
- In the new-game flow, connect BeginPlay execution to Get Data Table Row, with DT_MiEconomia and Row Name
Defaults. - Connect Out Row to Break ST_EconomyRow and Price to New Value on Try Set Value. Connect Wallet to Target and connect Row Found execution from Get Data Table Row directly to Try Set Value.
- Check the Try Set Value bool with Branch before continuing initialization. On False, pass Out Error to Print Scientific Number Error. Connect Row Not Found from Get Data Table Row to a missing-row message and end that path.
Expected result: Wallet contains 1000. If Price has a typed numeric error, Try Set Value returns False and keeps the previous balance. For a saved game, use the load path in section 11; do not reapply the starting balance.
D. Import, export, and validate with Unreal
- Use the CSV you exported in the editor as the import template; keep the header and Gameplay Tag format written by Unreal. The native editor can also export and import JSON. Review the table after each import and save it from its editor when you are done. If Unreal shows import errors, fix the file and import again. Validate Assets checks the content stored now; it does not replace reviewing import errors.
- In the Content Browser, right-click DT_MiEconomia and choose Asset Actions → Validate Assets. Review the result in Unreal’s validation report.
The Scientific Number Tools editor validator looks for reflected FScientificNumber fields in any row structure and traverses nested structures, arrays, sets, and map keys and values. An error identifies the asset, row, full property path, and numeric reason. A value with a typed error, such as Overflow, is invalid numeric content; a malformed representation receives a distinct diagnostic. The validator does not change data or impose game rules such as requiring a positive price. It only inspects FScientificNumber fields; it does not validate Packed or Safe.
What you have built: a configuration with your own schema, row lookup using Unreal’s native functions, and a check of numeric content before using the table.