Creating an Enumeration¶
To create an Enumeration, you'll need to select Add > Blueprint > Enumeration from the Content Browser.
Definition¶
The Enumeration Editor allows you to define a list of named values that can be used as a data type in your Blueprints. You can add an entry by clicking and then filling in the Display Name, and optionally, the Description.
The following example shows a simple enumeration used to represent different weapon types.
You may add as many entries as you need. Note that the Enum Description, the Display Name and the Description are FText
instances and can be localized. See the API Reference to learn more.
Additionally, under Advanced, you could mark the enumeration as Bitmask Flags, in which case the values will be powers of two, allowing you to combine them using bitwise operations.
Usage¶
Just like any other data type, you can declare variables of your Enumeration in your Blueprints and pass them around as arguments to functions.
Bitmasks¶
If you mark the enumeration as Bitmask Flags, you can declare a Bitmask variable of the enumeration type, which will allow you to select multiple values at once. To do so, you need to declare an Integer variable rather than using the enumeration type directly. You then need to mark the variable as a Bitmask and set the target enumeration as the Bitmask Enum type:
The variable will be displayed as a multi-select dropdown, allowing you to select multiple values at once:
Select¶
The Select node in Blueprints can accept an enumeration as Index and return an associated value for each entry:
Switch¶
Every Enumeration has an associated Switch on Enum node that allows you to control the flow of execution based on the value of the enumeration: