Broken While Loop node

Hello.

I think that the While Loop node is bugged.

In this really simple example, when pressing the spacebar the time is reset to 0 and for 5 seconds the While Loop SHOULD execute the body.
Yet, I got an "Infinite Loop " error.

Ever tried the While Loop on the last Unreal release ?

Thank you.

The while loop is definitely not faulty, you’re just using it inappropriately. Using a timeline would be a better approach in this case.

The infinite loop error can be encountered even if there isn’t an infinite recursion going on due to the max iteration limit, which you can adjust from the project settings. You can also fix this issue by executing delays between each iteration. But like I said, timelines would be more appropriate for this task.

Hmmm…you’re right. I’ll try the Timeline way.
The While node is too hard to handle, and it doesn’t like Delays inside the loop.

Thank you.

for-loop and while-loop execute all the bodies in a single frame. One tick = one frame.
you must break the loop condition in the same frame.otherwise this frame will stuck forever due to the loop can’t finish its job.

in your example,you use tick to accumulate the time but that needs multiple ticks/frames to accomplish it.
so the loop will not be able to know it.
what the loop will do is checking a 0.0 float variable again and again and the 0.0 float variable never changed.

Thanks Baobao.
I’ll experiment more with this problematic While loop. It seems I need to connect it to the Event Tick at this point.