The enum is used to declare an enumeration, which is a set of named constants. It’s like an array of “names” and each name can has own value.


Creating enum

To create new enum press ‘plus’ button on the right side of Enums section:

Note: If you can't find this section, check its visibility in the panel 'Hidden script objects' in the bottom of toolbar.


To add new elements to enumeration press 'New' button in ‘Enum elements’ section:


To delete elements from enumeration press [X] button on the right side of element that must to be deleted. You can change the order of elements by dragging sorting button on the left side of each element. Rename elements by double clicking on its name.


Using enum

After compiling script you will able to use this enum in code. Create variable with type of your Enum and use it in code:


Enums works fine with ‘Switch’ node, which identifies what statement to run based on value of enum:


In inspector enums are displayed as popup button:

Render time: 0.02 seconds
137,020 unique visits