Loop
Type | Script block |
Collider | None |
Folder | Control |
Ports | |
---|---|
Inputs | Before Start Stop |
Outputs | Do Counter After |
The Loop block is used to run a script multiple times in the same frame. Often used for processing every element in a List.
The loop will execute everything connected to the Do wire Stop - Start times, with the counter incrementing (or decrementing) from Start to Stop on each iteration.
Notes
- The counter always steps by 1 (or -1, if Start is greater than Stop).
- If a non-integer value is provided for Start, it's rounded down to the next smallest integer.
- If a non-integer value is provided for Stop, it's rounded up to the next biggest integer.
- The counter includes the Start value, but excludes the Stop value.
Example
One of the most common uses of loops is to perform some operation to many blocks at once. To do that, the blocks should be added to a List.
In the example below, we're moving the blocks by (0, 0, 0.1) every frame.

It's mentioned previously that the Counter won't output the Stop value by the end of the loop.
It won't be a problem because after we add the last block to a list, it increments the $Length
variable by one.
So, if the last block is assigned to index 4, $Length
would equal to 5 which is exactly what the Stop input should be to account for every block.