Logic
Loop
Last updated September 28, 2018
Description
Loop through a range of numbers or a group of objects.
Properties
Triggers Repeatedly on Event
| Loop Style | Select style of loop: choices are 'Repeat', 'For Each' and 'Conditional' |
| Number of Times (Repeat Only) | Repeat all children a given number of times. Indexing starts at 0. |
| Tag (For Each only) | Select a tag to iterate through all objects in this group individually |
| Start Index (Conditional Only) | Loop will start with index equal to start value. Whenever the behavior is reset, index returns to this value. |
| End (Conditional Only) | Loop will continue to run so long as this condition is met. |
| Await Children | Wait for all behaviors inside the loop to finish before starting the next iteration. For example, you can have a Wait behavior that adds a delay between each iteration. |
| Increment Index By (Conditional Only) | Amount to add after each iteration of the loop |
| Reset Loop Index on Disable | Reset the current index when this behavior is turned off. When this is off, you can resume where you left off by turning it back on. |
| Reset Loop Index on Completion | Reset the current index when this loop is finished. When this is on, you can re-use your loop multiple times. |
Outputs
| Count |
Outputs the number of times the loop has occurred. |
| Index |
Outputs the number of children within the loop. Indexing starts at 0. |
Examples
Selecting a tag and the 'For Each' loop style allows you to calculate distance to each object in a group separately rather than using the average.

