Help with an infinite loop

I’m getting an infinite loop on a function that replaces the ground tiles with water if a coast generates near it. It’s pretty simple and it’s an exact duplicate of the function that generates deep water and the coast; they don’t cause infinite loop errors.

It only happens maybe like 1/5 times, if I follow the error the HISM call is what “causes it”, allegedly. Or sometimes it’s the default for each loop macro?

I don’t get why I’m getting this error as the other functions that literally are the exact same don’t give me errors.

Any help appreciated.

The infinite loop warning doesn’t necessarily mean an infinite loop, it also happens if you just simply have a lot of loops.

You can try to increase the Maximum Loop Iteration Count in the project settings and see if it goes away:

286313-max.png

If changing the Iteration Count solves your problem, you might consider optimizing something somewhere, as exceeding the default count might be a sign of badly performing code.

If it does not solve it, and it is actually an endless loop, you can open the Blueprint Debugger in Window → Developer Tools and check if the Call Stack indicates that you’re things get called recursively endlessly.

1 Like

Well, I believe it counts all iterations in the frame, not only the current loop. Also, if I remember right, BP loops count more to the iteration count (I’m not sure exactly how is it calculated, but not the way you’d expect it).

Hmm I’ll try the bp debugger and update never heard of it thanks!

The thing is, at most it’s iterating 1-5k times cause it iterates for every coastal tile. So I’m really confused as to how it’s even coming close to approaching the limit. That’s why this infinite loop has my panties in such a twist, anyways will try the thing you said and update.

Hmm I don’t think I’m understanding how it works, it doesn’t seem to show anything unless I put a breakpoint on the call and even then it’s just stating I have a breakpoint on the call.

Oddly enough though if I keep telling it to simulate it just keeps recalling the hism independent of the for each loop. If I keep clicking step over the second branches false leads me back to the call? Which doesn’t make sense as the false isn’t hooked up to anything shouldn’t it just do nothing?

I remembered that the infinite loop error actually breaks the blueprint execution, and jumps to that point even if you don’t place a breakpoint (just be sure to enable Blueprint Break on Exceptions in the Editor Settings). If it does not, then I remembered wrong, and it ain’t gonna help you :confused:

286379-break.png

Yup it puts me at that HISM call but I still don’t know why it’s just saying infinite loop. And it’s not an infinite loop I see no way how it’s possible.

It does that even if you increase the iteration limit?

Yeah I already had my iteration limit increased above the default.

Okay I set it to the absolute max and after much testing I think it doesn’t run into that error anymore. So thanks for the idea, I already had it way pumped up so I didn’t even think about it.

Hi I’m having problems of a message log not allowing me to use my camera switch from 1st to third using the v button on keyboard. Its an Infinite Loop On a timeline node.