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