Data-driven UMG

In the process of doing projects, newbies generally list and superimpose functions, and do not think too much about maintainability. In this way, when we modify the functions and requirements later, it will become very troublesome, or even rewritten. This is especially true for UMG (UI) systems. If we want to display the item information (icon and price) in the store, if maintainability is not considered at the beginning, it will become very troublesome when we add and delete items in the store later. The following recommends a Data-Driven UMG (data-driven), this idea can be applied to any engine.


The core part of the Data-Driven system is the data itself, so we need to create a data table (DataTable) [of course, various forms such as XML, JSON and database can also be used, but DataTable is the most friendly to art] to Store all product information in the store. First, we create a structure to represent the information of each row of products, and then create the aforementioned DataTable, the result is as follows:



After the data is created, the interface is created. First create a Widget blueprint to represent each row of product information. And create a custom method to set the value of UMG (Binding is not used here, because the efficiency of Binding may be slightly lower in comparison), the specific effect can refer to the following figure.



After that, you can create the main interface. For details, please refer to the following figure.



In this way, we can change the data in the DataTable at will, so as to achieve the effect of timely updating in the interface. The project can refer to this link (due to the StarterContent, it may be larger)




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325458355&siteId=291194637