Flow Control Nodes

In the Node Menu, under “Utilities,” is the Flow Control category. This category contains several different Nodes that you can use to control the flow of execution in your Blueprints. This is essential to creating logic.

Branch Node
Delay Node
Do N Node
DoOnce Node
DoOnce MultiInput Node
FlipFlop Node
ForLoop Node
ForLoopWithBreak Node
Gate Node
MultiGate Node
Retriggerable Delay Node
Sequence Node
WhileLoop Node
Switch on Int Node
Switch on Name Node

Branch Node

Branch Node
Branch Node

The Branch Node takes in a Boolean value as its input and then continues execution either through the True output execution pin if the Boolean value is True, or through the False output execution pin if the Boolean value is False.

Delay Node

Delay Node
Delay Node

Once activated, the Delay Node will wait for the number of seconds specified by its Duration pin and then fire its Completed pin.

Do N Node

Do N Node
Do N Node

The Do N Node means “Do N times” where “N” is the number of times this Node should allow execution to pass through it before it begins to block execution. For example, if N is 5, then the first 5 times execution flows into the Enter pin it will flow out of the Exit pin. However, the 6th time and beyond that, the flow will not continue out of the Exit pin.

Execution will be blocked in a Do N Node after the Nth time the Node has been activated, unless execution flows into the Reset pin of the Node. When execution flows into the Reset pin, the counter will be reset to 0 and the Node will be able to execute N more times.

The Counter pin will output an Integer representing the number of times the Do N node has been activated since the game began or since the last time the Node was reset.

DoOnce Node

Do Once Node
DoOnce Node

The DoOnce Node is just like a Do N Node where N = 1. With the exception that with the DoOnce Node, you have the option to have the Node start closed. By having the Node start closed, this means that execution must flow through the Reset pin before execution will flow through the Completed pin, even the first time.

DoOnce MultiInput Node

DoOnce MultiInput Node
DoOnce MultiInput Node

The DoOnce MultiInput Node is like the DoOnce Node except that it allows for multiple In/Out pairs. Additional pairs can be added using the “Add pin” button at the bottom. So if execution flows into the A In pin, it will flow out of the A Out pin. If execution flows into the A In pin a second time, without a reset, nothing will happen, but execution will still be able to flow through the B pins and the C pins.

If execution flows into the Reset In pin, all of the pairs will get Reset. The DoOnce MultiInput Node also differs from the DoOnce Node in that it has a Reset Out pin that will be executed when the Reset In pin is executed.

FlipFlop Node

FlipFlop Node
FlipFlop Node

The FlipFlop Node simply alternates between having execution flow out of the A pin or the B pin every time the Node is activated. The first time execution flows into the FlipFlop Node, it will flow out of the A pin, and the second time execution flows into the FlipFlop Node, it will flow out of the B pin, and then the third time, it will flow out of the A pin again, and so on.

The FlipFlop Node has a Boolean output called Is A that will output a value of True if execution is currently being routed through the A pin, and False if execution is being routed through the B pin.

ForLoop Node

ForLoop Node
ForLoop Node

With a ForLoop Node, the Loop Body execution output pin fires a certain number of times, starting from an Integer defined by the First Index, and then increasing by 1 until it gets to the Integer defined by the Last Index. The Index pin will output an Integer specifying the index of the current loop. The Completed pin executes after the final loop completes.

ForLoopWithBreak Node

ForLoopWithBreak Node
ForLoopWithBreak Node

The ForLoopWithBreak Node is just like the ForLoop Node, except that it is possible to break the loop before it is finished. If execution flows into the Break pin, the loop will stop immediately and the remaining loops will not be executed.

Gate Node

Gate Node
Gate Node

A Gate Node is a Node that can be set to opened or closed. When the Gate is open, execution flow entering the Enter pin will flow out of the Exit pin. When the Gate is closed, any execution flow entering the Node will stop there, and the Exit pin will not fire.

The next three input pins are used to set the status of the Gate. Any time execution flows into the Open pin, it will open the Gate, and any time execution flows into the Close pin, it will close the Gate. If execution flows into the Toggle pin it will set the status to whatever it is currently not. So if the Gate was open, the Toggle pin would close it, and if the Gate was closed, the Toggle pin would open it. The Start Closed property will determine whether the Gate starts out Open or Closed.

MultiGate Node

MultiGate Node
MultiGate Node

With a MultiGate Node, execution enters a single execution input pin, but it will flow out of only one of the execution output pins. You can use the Add pin button to add as many execution output pins as you like.

If Is Random is unchecked or set to False, then execution will flow out of the output pins in sequential order, starting at the Start Index. With a Start Index of -1, it’s the same as saying that you’re not specifying a Start Index, so it will just go with the default which is 0. Loop will determine whether or not the sequence should start over or if the Node should just block further execution flow.

If Is Random is set to True, then instead of going in sequential order, output will flow out of the pins in random order until each pin has been used. At that point, the Node will either need to be reset or start a new loop, depending on what Loop was set to.

Retriggerable Delay Node

Retriggerable Delay Node
Retriggerable Delay Node

The Retriggerable Delay Node is just like the Delay Node, except that the delay can be reset or “retriggered” if another pulse enters the execution input pin before the delay has finished counting down. So if the duration of the delay is set to 10 seconds, and the Node is activated, and then after 7 seconds the Node is activated again, the delay will start counting down from 10 again.

Sequence Node

Sequence Node
Sequence Node

With the Sequence Node, every time execution flows into the Node it will flow out of every single one of the output pins. Again, you can use the Add pin button to add as many output pins as you want. When execution flows into the Node, it will fire each of the pins sequentially, however it will do so without any delay, so from the player’s perspective it will appear as if each of the pins fired at the same time.

WhileLoop Node

WhileLoop Node
WhileLoop Node

Once the WhileLoop Node activates, the Loop Body pin will fire over and over again, as long as the Boolean value connected to the Condition pin is True. Before each loop iteration, it will check the value of Condition, and once the Condition is False it will break the loop and execution will flow out of the Completed pin. It’s important to make sure that there is definitely some way for the Condition to eventually evaluate to False, or you will end up with an infinite loop.

Switch on Int Node

Switch on Int Node
Switch on Int Node

Switches are a way to route the flow of execution based on the value of whatever variable you pass into the Switch. For example, if you create a Switch on Int Node, you can connect an Integer variable to the Selection pin, and then when the Node is activated, it will read in the value of the Integer and based on that value, route execution to one of the output pins.

By default, the only output pin is the Default pin. The Add pin button can be used to create more output pins and will create them starting with the value of the Node’s Start Index property, and then incrementing by 1 each time the button is pressed. If you want to delete one of the pins you added, you just need to right-click on that pin and click “Remove execution pin”.

Switch on Name Node

Switch on Name Node
Switch on Name Node

You can also do a Switch on other data types as well. For example, you could use the Switch on Name Node. This will work the same way as the Switch on Int Node, with the exception that you will need to specify the text to compare against for each of the output pins. You can do that by going over to the Details Panel, expanding the Pin Names property, and entering the text you want each pin to check for.