Structures

A structure, also known as a struct, is a composite data type that can group variables of different types into a single type. An element of a structure can be of a complex type, such as a structure, array, set, map, or object reference. 

To create a structure, click the Add New button in Content Browser, and in the Blueprints submenu, select Structure, as shown in the following screenshot:

Give a name to the structure created and double-click it to define its variables. In the Structure Editor, click the New Variable button to add variables to the structure. Each variable can be of a different type, and you can click on the container icon to turn the variable into a container, such as an array, set, or map. The following screenshot shows the variables of a structure named Weapon Type in the Structure Editor. Note that the Category variable is of the enumeration type, like the Weapon Category variable that we previously created:

To use the Structure data type, create a variable in the Blueprint Editor, click the Variable Type drop-down menu, and search for the name of the structure, as shown in the following screenshot:

Compile the Blueprint so you can edit Default Value. The next screenshot shows the structure, filled with example values of weapons:

The float variables in the previous screenshot use relative values that represent percentages. For example, 0.5 is 50% and 1.0 is 100%.

For each structure type, there are Make and Break nodes available for use in a Blueprint. The Make node receives the separate elements as input and creates a new structure. The Break node receives a structure as input and separates its elements. The next screenshot shows the Make and Break nodes of the Weapon Type structure:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset