Blueprint Structure (Structs) | Unreal Engine

What is a Structure in Unreal Engine?

A Blueprint Structure or Struct is essentially used in Unreal Engine to store a lot of different variables together.

They are similar to Enums in the way that you store a list, but, in this case, the list is made up of variable values.

That’s why in Structures, you will basically create a list of different but related variables in a group. However, unlike Arrays, the variables can have a completely different data type.

For example, if you have a weapon, you can store and organize the variables for the weapon name, current ammo, weapon mesh, weapon damage, weapon icon, weapon rarity, weapon description, weapon location… whatever information you need.

That’s why Structs are used for a lot of purposes, like weapons, enemies, inventory systems, or basically any information that you need to store together.

Here are examples of some of the most commonly used structs within the engine, which you may have already encountered. These include Transform structures, which consist of location, rotation, and scale; Hit Result, often used with Line Traces; and Post Process Settings, containing numerous variables that can be enabled for output in the details panel as needed.

Structure Examples Unreal Engine

How do you create a Structure?

To create a Structure, simply right-click or use the ‘+ Add‘ button in the Content Browser, then select ‘Blueprint → Structure‘.

Create Structure Unreal Engine

How to create a list of variables?

To create a list of variables inside the Structure you’ve created, open the file and press the ‘Add Variable‘ button.

Now, create a list of all the variables you need. You can combine as many data types as you want, as shown in the example below.

Click on the ‘Default Values‘ tab to set up the default values for the variables.

Add Variable Structure UE5

Using Structs in Blueprints

Create a Struct Variable

To access the Structure variables inside any blueprint, just create a variable and set the structure as the variable type.

In the Details panel, you can also set and change the default values.

Create Variable in Unreal Engine
UE5 Create Structure Variable

Break and Make Structure

Once you have set up your Structure variable, to access the variables inside it, you just have to get the variable and connect it to a ‘Break Struct‘ blueprint node.

Alternatively, you can right-click on the output pin and select ‘Split Struct Pin‘.

To change values, you can use a ‘Make Struct‘ blueprint node and connect the output to ‘Set’ the variable. However, a better way to do this is by using the ‘Set members in Struct‘ node.

Break and Make Structs Unreal Engine

Set members in Struct (better option)

If you want to change variable values, a better way is to use the ‘Set members in struct‘ blueprint node.

Simply select the node, and in the details panel, you will be able to enable the pins that you want to modify. Once clicked, they will be added to the node, allowing you to edit the values using blueprints.

Struct in Array

You can also convert the struct variable into an array to use it for more elements, such as more weapons or enemies. However, a better option for this is to use the struct to create a Data Table.

Struct Array UE5

In Unreal Engine, Structures are commonly used with Data Tables. We will explore this in a future tutorial in this blog post, so stay tuned!

Hope this helps! Keep on creating!

Unreal Engine Learning Path