Skip to content

Enumerated Types

Enumerated types are widely used in programming. When you have a limited list of possible values, using enum instead of int or string is often convenient.

Example

If you have a limited set of Colors to choose from in your game, you should store the value as an integer (1,2,3,4,...) to save memory. However, you can define a new enum, making your values more readable and convenient.

public enum Color
{
    Red = 0,
    Green = 1,
    Blue = 2,
    White = 3,
    Black = 4,
}

Now you can use values like Color.Blue in your code instead of 2.

How to create an enum

  1. Select the Data Structure section.
  2. Switch to the Enums subsection.
  3. Click on the Create Enum button.

    Screenshot

  4. Each Enum has several parameters.

    Name Description
    Name This name is used when you work with your enum from code.
    Display Name The name displayed in Balancy.
    Description Helps other team members to understand what this Enum is used for easily.
    Multi-selection Defines if a parameter can contain multiple enum values.
  5. Each enum value must have a unique name and a unique value associated with the name. If you use Multi-selection, all the values must be a power of 2 or equal to zero.

  6. When you create and save your enum, you can choose the type Enum for a parameter.

    Screenshot