Switch
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
Name | Data Type | Description |
---|---|---|
Enter | Trigger | The input execution that triggers this node. |
Input | Number | The 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
Name | Data Type | Description |
---|---|---|
0 | Exec | Execute the next node when the input index is 0. |
1 | Exec | Execute the next node when the input index is 1. |
2 | Exec | Execute the next node when the input index is 2. |
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.