When making a game, you often want events to happen at specific times. There are multiple different nodes for different situations. In this article we'll cover nodes that Execute the next logic after a set period of time.
You can use the Interval node to delay or repeat an action. The Interval node will execute the output after a set amount of time. It can also be set to loop, so it repeats the action again and again.
If you execute the Interval and Allow Override is enabled, it will cancel the interval and restart it from the beginning. For example, if you execute the interval with a button, and have Allow Override enabled, every time you push the button, the interval will start from 0 again and not execute its output.
In this example, the Interval is set so that once 1 second passes, the cube will turn red. Because the button keeps getting pressed, and Allow Override is enabled, the cube doesn't turn red until we stop tapping the button, as this resets the Interval.
If you want to delay a value (vector, number, or object), you can use the Delay node. The output will pass the input value after a specified delay.
For more control over executing logic over time, you can use Timelines. This is for more advanced animations. Timelines also support executing outputs and broadcast signals at specific keyframes.
In addition to the nodes mentioned above, many other nodes also have an option to execute when an action is done.
The Mover/Rotator/Scaler nodes, for example, can execute an output once they have completed their action by simply dragging a link from On Loop/End
.
In this example, the cube is set to turn red once the rotation is completed.