Skip to main content
Version: 3.9.0

Switch

if

Use Switch to take different executions according to the input index. You can add click the "+" to add more outputs. Switch is in the Control category.

Input

NameData TypeDescription
EnterTriggerThe input execution that triggers this node.
InputNumberThe input rounded value, controlling which execution to be taken. For example, if the input is 1.4, it will be rounded to 1; if it is 1.5, it will be rounded to 2.

Output

NameData TypeDescription
0ExecExecute the next node when the input index is 0.
1ExecExecute the next node when the input index is 1.
2ExecExecute the next node when the input index is 2.

Example

switch example

This example demonstrates an effect where tapping the screen will randomize the icon that appears on the screen. It generates a random number and corresponds each number to a texture for the 2D image. When you tap on the screen, it will trigger the switch.

tip

The default number of output ports is 3. Click the “+” button at the bottom right corner to add more ports.

switch node