In this guide we will be going over what Enums are in Unreal Engine 4 and how they are used in engine.
What is an Enum?
An Enum (also known as Enumeration) is used to give names to integer values.
For example, a basic game menu state can be represented as names and programmed as integer numbers.
– 0 = Mainmenu
– 1 = Game
– 2 = Pause
– 3 = Gameover
All game engines can use enums as they are a basic programming feature. Unreal engine can use enums in c++ and blueprints.
In the next section we will be creating our own Enum in Unreal Engine 4 Blueprints.
Creating the Enum
Firstly, right click the content browser and hover over the blueprints tab.
Click the Enumeration button to make the enum.
Secondly, add the names that you need for your enum.
In this example we will be using mainmenu, game, pause and gameover.
Using the Enum
Lastly, with your new ENUM we can trigger different logic based on the value.
This can be done easily using a switch node.
Right click in any blueprint class and type “Switch on YOUR-ENUM-NAME”. In this case the node is called “Switch on gamestate”.
If you don’t know how to use switch nodes check out our guide here.
Conclusion
Now you have a working blueprint enum in Unreal Engine 4!
Even though this guide is short, We felt it was essential as there are very few guides for creating and using enums in blueprints.
Enums are extremely useful and most projects have many uses.
In future guides we will be using enums frequently which is why this guide is important for the future content of the site!
If you have any suggestions for future guides and projects, let us know by sending a comment below or by contacting us.
Further Resources:
Unreal Engine 4 official enum video (2014)
Our guide on Switch nodes in Unreal Engine 4
Leave a Reply