I need a workaround on "Inifinite Loop detected"

Part of my blueprint needs to loop through an array of more than 700,000 elements. But, it already stops at the for-each loop, prompting the error “Infinite loop detected.”

I am trying to generate a point cloud so it is necessary that my program be able to generate at least more than 1 million points. I hope someone here knows a workaround on this one. Thanks in advance!

A workaround would be to break the loop into numerous small steps and complete them in sequence. You can also:

Hi, Everynone. Could you give me some tips how to break down the loops into smaller bits in blueprint? I don’t see any node that could help me do that.

Also, thank you for letting me know about the Project Settings option. I saw that my project has a limit of one million, but I still get the same error at 700,000+ points. Bumped it up to 2million and it’s still the same.

Dear Everynone,

Thank you again for the tip. I tried to increase the maximum loop iteration value to 10 Million. I found out that it counts not only the per-loop iteration, the processes within the loop is also included toward the count to maximum number of iterations.

The runaway loop counter typically resets every tick. So one approach would be to spread processing into chunks over multiple ticks. Where does the input array to the foreach loop come frome? This can be a common mistake as the function providing the array will be called for each iteration as well. Try searching other threads with the same issue, not too long ago I spent a while answering one here Absolute BS infinite loop error...

1 Like

The runaway loop counter typically resets every tick

Apparently, the UE5 sports this fancy thing I’ve never tried:

image

Rather than doing ForEach for 1 gazillion elements, you’d take the 1/4 gazillion and do it 4 times.


Last time I tried to loop 1.000.000 in BPs, it was mostly crashing and freezing. More than usual, that is.