Enumeration (Enum) Blueprint | Unreal Engine

What is an Enumerator?

In Unreal Engine, the Enumeration, also known as Enum, is used to create lists.

These lists can store words for anything, such as characters, locations, enemies, weapons, combat phases, or whatever you can imagine within a video game.

Enums are easy to use and incredibly useful for keeping things organized and accessible because each element in the list is assigned an integer number.

Essentially, we are assigning a word to a number and adding it to a list.

Add Enumerator UE5

What are the differences between Enums and Arrays?

Unlike arrays, the order of the elements in the list is not really important.

Also, arrays can store variables, while enumerators are only used for listing named values.

Additionally, using an Enum is usually more performant than using a String Array because it only checks the values in the listing, not the individual letters that form the String.

How do you create an Enumeration?

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

Create Enumeration Unreal Engine

How to create a list of values?

To create a list of values inside the enumeration you’ve created, simply open the file and press the ‘Add Enumerator‘ button.

Feel free to add a description for every item in the list. However, it is optional. You just need to fill in the ‘Display Name’.

Add Enumerator UE5

Using the Enum in Blueprints

Switch on Enumerator

Once you have set up your Enum list, you just have to use a ‘Switch on (Enum Name)’ to execute logic depending on the currently selected enumeration.

As you can see in the example below, if the selection is the Bicorn, then a Print String will execute. If the selection changes, nothing will be executed.

Here, you can also see why descriptions are useful, as you will see the description for every item when you place the cursor above it.

Switch on Enum Unreal Engine

Enum Variables in Unreal Engine

Another way to use Enums in blueprints in Unreal Engine is to create a variable with the Enumeration as the Variable Type.

To do this, simply create a variable and search for the name of the enumeration list you want to use.

UE5 Create Enumeration Variable

By having the list as a variable, you can ‘Get‘ and ‘Set‘ the current Enum value inside Blueprints.

You can also use ‘Equal (Enum)‘ or ‘Not Equal (Enum)‘ to obtain a Boolean (true or false) output and execute an action based on the enumerator value.

Use Enum Variable Unreal Engine

In Unreal Engine, Enumeration is 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