SOLVED: Infinite Loop Detected

Hey everyone, I’ve been messing around with some code as of late that allows me to render a planet in segments for an endless runner.

Originally all the assets were made for a Linear Endless runner such as ‘Subway Surfers’ / ‘Temple Run’, however I decided to change the art style to represent more of a planet that you loop around.

Meshes have been re-done, collision re-added, etc. When I run the game in ‘Simulated’ everything works perfectly:

However once I try to run the game in ‘Selected Viewport’ I get this error:

Here is the ‘TreeGenerator’ blueprint overview:
(I apologize about the messy code, had to make everything closer so it’d fit in one image)

Here is the ‘GetRotationAndLocationFromSurface’ node blueprint:

UPDATE: The game only crashes causing the error when my Character is spawned… I tried dragging and dropping my character into the world then simulating it but I now get the exact same error as above. I have no reason to believe that the problem is directly the Character’s Blueprints but here it is just in-case…

UPDATE: I’ve furthered my progress at narrowing down what the issue could be and it appears that the Character is the culprit, not the ‘TreeGenerator’ after all. The error only appears when I try adding the same ‘GetRotationAndLocationFromSurface’ node to the event tick on the character.

Any help with this problem would be greatly appreciated.

How many times does that for loop in the tree generator fire? The max loop is 1,000,000 in one tick.

1 Like

The initial ‘ForLoop’ last index is based on a variable called ‘SpawnAmount’ which by default is 10, each loop I spawn a child actor inside the ‘TreeGenerator’ bounds and add the spawned child actor to an array. Once that loop is complete it then run the ‘ForEachLoop’ based on the child actor array which should only fire the same amount of times as the initial ‘ForLoop’.

Hopefully I explained that simply enough.

SOLVED: After some messing around it turned out it was my ‘GetNextTransform’ function along with the Character spawning inside a collision volume. When the collision volume is overlapped it would spawn another road segment at the last spawned road segments ‘GetNextTransform’. This road segment would spawn but the transform was based on rotation not an actual arrow component in the blueprint which would make it continuously spawn in a single location once it made it so far around the loop. There for creating an infinite spawning loop.

Just in-case the above sentence doesn’t make any sense here are some images…


With Arrow Components Transform.

Without Arrow Component Using Rotation Value:


(Circled area is the spot the where the road segments keep spawning)

213833-capture6.png