UDataTable
#include "Engine/DataTable.h" Description
A spreadsheet-like asset that maps FName row keys to structs inheriting from FTableRowBase. Import from CSV or JSON, then look up rows in C++ or Blueprint at runtime.
Signature
class UDataTable : public UObject Caveats & Gotchas
- • All rows must be the same struct type — you cannot mix types in a single data table.
- • FindRow<T>() returns a pointer to the in-memory struct, not a copy. Do not hold this pointer across frames or operations that might invalidate the table.
- • Reimporting from CSV after a struct change will drop columns that no longer exist in the struct — back up data before modifying the row struct.
- • Avoid very large data tables in shipping builds; prefer splitting them into smaller tables loaded on demand.
Example
Look up a row at runtime C++
// Assume WeaponTable is a UPROPERTY pointing to a UDataTable with FWeaponRow rows
FWeaponRow* Row = WeaponTable->FindRow<FWeaponRow>(TEXT("Sword"), TEXT("Weapon lookup"));
if (Row)
{
float Dmg = Row->Damage;
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?