I’m fully aware that if I use latency, loops will not wait.
Does anyone know if the foreach loop will wait for the body pin before continuing, or does it just generate threads?
Thanks
I’m fully aware that if I use latency, loops will not wait.
Does anyone know if the foreach loop will wait for the body pin before continuing, or does it just generate threads?
Thanks
The foreach completed pin should execute after the loop is finished. For a simple example of a foreach loop here’s one from Unity.
public GameObject[] things; //The array variable
IEnumerator event () { //The event that executes the foreach loop
foreach(GameObject i in things){
//Loop Body
Debug.Log(Time.time);
yield return new WaitForSeconds(1);
//The loop waits 1 second before the next iteration
}
//Loop Body should have executed things.Length() times before continuing.
//Completed
Debug.Log("Finished");
}
However if the event is called multiple times like Event Tick, it will start a new loop every time so the first loop’s Completed will execute before the second loop’s Loop Body has finished.
M4g5o, thanks for this.
I guess my question really is ‘Does the sequence node wait for each pin?’, as that’s what’s in the foreach macro.
I get conflicting answers about that.
At the moment, I have made a ForEachNext just to be sure…