{ }Blueprint → C++

Unreal Engine 5 · Blueprint → C++

Switch on Enum in Unreal Engine 5 C++UE Docs

The Blueprint Switch on Enum node is a C++ switch over an enum value. Each enumerator becomes a case EMyEnum::A: style label.

Blueprint node & C++ equivalent

C++
switch (MyEnum)
{
  case EMyEnum::A: /* ... */ break;
  case EMyEnum::B: /* ... */ break;
}

What does the Switch on Enum node do?

Switch on Enum branches execution based on an enumeration value, giving one output pin per enumerator. It is the type-safe way to handle a fixed set of named states, such as a movement mode or game phase, with each state getting its own execution path.

The C++ equivalent

Write switch (MyEnum) and add one case per enumerator using the scoped name, for example case EMyEnum::A: and case EMyEnum::B:. For an enum exposed to Blueprint you typically declare it as enum class EMyEnum : uint8 with the UENUM(BlueprintType) macro, so the same enum drives both the Blueprint node and the C++ switch.

Common mistakes

Always reference enumerators with their full scope (EMyEnum::A), because enum class enumerators are not injected into the surrounding namespace and an unscoped A will not compile. Add break; after each case, and if you do not handle every enumerator, a default: keeps behavior predictable when new values are added later.

Frequently asked questions

What is the C++ equivalent of Switch on Enum in Unreal?+

A switch (MyEnum) statement with one case EMyEnum::Value: label per enumerator. It works directly on a UENUM(BlueprintType) enum class.

How do I switch on a UENUM in C++?+

Pass the enum variable to switch and use scoped case labels like case EMyEnum::A:. The enum should be declared enum class EMyEnum : uint8 for Blueprint compatibility.

Related Flow Control nodes

View all Flow Control nodes →