Data Tables in Unreal Engine

What is a Data Table in Unreal Engine?

Data Tables are used in Unreal Engine to store information, similar to a spreadsheet. They provide a convenient way to organize and manage game data.

The information in Data Tables is read-only, it can’t be modified during runtime. However, it is still extremely useful for storing all the information about enemies, weapons, items, attacks, and other game elements that the game can reference. Typically, this includes values such as an enemy’s name and total health, which remain constant throughout the game, or an item’s name and its value when sold.

Data Tables in Unreal Engine

To create a Data Table, you will need to first create a Structure. If you have never used Structs before, please read our lesson about Structures before continuing.

A struct will establish the default values for the data table, much like creating columns in a spreadsheet. Each column in a spreadsheet stores values such as names, numbers, dates, or currency. Within the struct, you’ll define the variables that you wish to access in these columns. Afterwards, you simply need to create rows for every enemy, weapon, item, etc.

Additionally, you can use Enums inside data tables. They act like a data validation list, allowing you to create a list of options and then reference that list in different places.

How do you create a Data Table?

To create a Data Table, simply right-click or use the ‘+ Add’ button in the Content Browser, then select ‘Miscellaneous → Data Table’.

Next, pick a row structure from the dropdown list. Here, you can either choose some of the default values that appear on the list or select one of the structures you created.

Finally, simply give a name to the Data Table.

Create Data Table Unreal Engine

How to create rows in a data table?

Now, open the data table, and you will see the variables that you set up in the structure displayed as columns.

Press the ‘+ Add‘ button to create as many rows as you need. By clicking on each row, you can easily change the variable values for every item on the list.

Tip: Row names are unique because Unreal Engine uses them to identify which row you want to read the information from, so the row names cannot be repeated within the same table.

Additionally, you can reimport the struct if you’ve made changes, as well as copy, paste, duplicate, and remove rows.

Data Tables in Unreal Engine

Using Data Tables in Blueprints

Get Data Table Row

To access the data table values inside blueprints, you simply need to use the ‘Get Data Table Row‘ blueprint node.

Then, select the desired data table from the dropdown list and choose the specific row from which you want to retrieve information. As you can see, row names are unique key values.

From the output pin labeled ‘Out Row‘, you can easily read the variable values by either right-clicking and selecting ‘Split Struct Pin’, or by directly connecting a ‘Break Struct’ node.

Get Data Table Row Blueprints UE5

Get Data Table Row Names

Another option is to use the ‘Get Data Table Row Names‘ blueprint node to access all rows inside an array.

You can combine this, for example, with a ‘Random Array Item‘ node to randomly select rows from the data table.

Get Data Table Row Names Blueprint Node

Does Data Table Row Exist

If you want to check in advance whether a row exists, you can easily connect the ‘Does Data Table Row Exist‘ blueprint node to a branch and decide how to execute based on whether the result is true or false.

Does Data Table Row Exist

Hope this helps! Keep on creating!

Unreal Engine Learning Path