Unreal 5 realizes the use of Data Table data table

Data is an important part of a game. According to the division of labor, the data will be allocated by the planner. Therefore, it is impossible for your data to be directly written into the blueprint, but there is a special data table for configuration.
The common way for everyone is to plan and edit in Excel, and then use the tool to generate the data format that the game needs to use, and finally hand it over to the program for use.
If you develop it personally, you can directly use the data table implemented inside ue. Next, I will explain to you how to use the data table.

Create a data table

If you want to create a data table, you need to create a structure first, which contains the data you have for each piece of data, which can be various types of data.
I am here to create the structure of the equipment. Now it is just for display and use, so the structure is relatively simple. The model is a skeletal mesh, and the name needs to be displayed on the UI, so the text is used directly. The equipment parts are clear, so the enumeration is used directly.
insert image description here
With the structure, you can right-click the folder to create a data table
insert image description here
. To create this file, you need to select the structure. You can directly select the structure you need.
insert image description here
After opening, it is the type of the table.
insert image description here
When adding data manually, click Add to add a piece of data, and then set the content of each piece of data below.
insert image description here

Using DataTables in Blueprints

To use the data table, first create a variable in the blueprint. After setting the variable type as the data table compile , set the
insert image description here
default value to drag the variables for the data table created for you
insert image description here
. You can get all the data names by obtaining the data table line name.
insert image description here
Here is the array of their default linen. Get the data table line for data. If the data can be found, you can interrupt the structure, and finally create a array from the internal obtaining data, add the array to the array
insert image description here

insert image description here

insert image description here

insert image description here

insert image description here

To sum up, this data is processed in a separate data table, which can separate the data and logic, and the structure is clear. It seems that you can also import data through files. I haven't tried it. If you have tried it, please remember to teach me.

おすすめ

転載: blog.csdn.net/qq_30100043/article/details/131374049