Whats causing my infinite loop?

what does the detect link function do? Can you post a screenshot of those blueprints?

i am trying to make simulation of electrical conduits… or something like cable connections…

DetectCN detects the cables above, below, left and right of the unit

Spark does all the work and sends signal to those connected cables… telling them if theres is a connection or not…


multi conduits are like [+] the are connectable above, below, left and right.

horizontal conduits are like [ - ] are connectable left and right.

vertical conduits are like [ | ] are connectable above and below.

you get the idea…


it works ok… but sometimes, the infinite loop crash appears…

why? i mean, i hesitated to use for each loop, and just used triggers as much as possible…


sometimes, i can get to 550 conduits with 50 multi linked and 500 horizontal conduits… all fine

stress test 2: 570 conduits with 70 multi, 500 horizontal conduits… crashed

stress test 3: 350 conduits with 100 multi, 250 horizontal conduits… crashed

stress test 4: 20 multi, 50 horizontal conduits,… crashed


further experiments, show that when creating too many “multi” conduits causes the crash

how is the crash happening?.. it is designed the it does nothing if it detects the the other cable already has power…

please help… i have already been stuck with this for a week, tried different kinds of logic…

most were made using for loops, and all those crashed with infinite loops…

this current logic is the best one, and does not drop fps one bit… only the infinite loop cases the crash…


Furthermore, the infinite loop log says, the infinite loop was caused by / asserted during set sprite…
which was very unrelated to the case of infinite loop…

which led me to think, that maybe the multi linked conduit is not the problem

I know there is a limit for blueprint iterations, but, how do i do this…

other games likeprison architect and rimworld and other games, successfully created a wiring system…
how is it not possible with UE4… hopefully someone can help…

Hi yanzco,

I would need a bit more information on your Blueprint setup to properly answer your question. Regarding increasing the max iteration count, you shouldn’t have to do this. If you are running into an infinite loop it is probably a for loop going out of control without anything to tie it down.

If you want to activate a loop and have it run continuously for a specified amount of time I would recommend what is called a “wait for next frame” delay to your loop then have a bool decide whether the loop continues or not. (see screenshot)

If you really want to know how to increase the iteration count you can find it in project settings under general settings.

Let me know if that helps,

hello @ adding a delay for 0.5 seconds before a retrigger in “Spark” somehow fixed everything…

i was able to make up to thousands of conduits, and, even using a thousand of ‘multi’ link conduits…

adding a delay even gave a beautiful effect that looks like a wave… powered = green, unpowered = red…
when everything is being re activated, the green wave… :slight_smile: it looks coool.

all fine now… :slight_smile:

now im working for the logic on when removing a conduit, it would turn off those connected except the one that is supplying it power…

! :slight_smile:

@Night watcher the detect link function are just 4 traces the possible placement of another conduit around the conduit itself…

it’s all fixed now, just added a delay before re triggering ‘spark’ … :slight_smile: