Skip to main content

Switch Statements

Use Blueprint Switch nodes to route execution to a different output based on an enum, integer, string, name, or gameplay tag.

Published Updated |
Blueprints
Variables
graphic

Use the Switch nodes to direct the flow of execution based on the given value, such as an enumerator, integer, string, name, or gameplay tag. You’ll find them in the right-click menu under Utilities > Flow Control > Switch.

Which Switch nodes are available?

NodeSelection TypeOutput Pins
Switch on IntIntegerAdded with the node’s Add pin button, numbered from Start Index
Switch on StringStringSet in the Pin Names array, or with Add pin
Switch on NameNameSet in the Pin Names array, or with Add pin
Switch on [Enum Name]EnumOne pin per enum entry, generated automatically
Switch on Gameplay TagGameplay TagSet in the Pin Tags array
Switch on Gameplay Tag ContainerGameplay Tag ContainerSet in the Pin Containers array

The Gameplay Tag nodes come from the GameplayTagsEditor plugin, which is enabled by default.

What can I configure on a Switch node?

Select a Switch node to edit these in the Details panel under Pin Options.

PropertyApplies ToDescription
Has Default PinAll Switch nodesAdds a Default output for values that match no case. On by default, except on Switch on Enum.
Start IndexSwitch on IntThe value of the first output pin. Defaults to 0.
Is Case SensitiveSwitch on StringMatches cases with exact casing. Off by default.

Frequently asked questions

Why is there no Add pin button on Switch on Enum?

The enum defines the outputs, so the node builds one pin per entry for you.

Why won’t my Switch on String compile?

Two of its cases are the same string. The compiler reports this with the error contains duplicate cases.

Check out the following resources to learn more about the subject.

Unreal Directive is free and ad-free.

If it saved you time, you can help keep it that way.

Donate