Infinite Loop error (no obvious loop)

I have a project involving an actor (pink meshes), that represents a room, when a collision volume in my pawn (pale pink volume around camera) is moved over it (Event begin overlap), the room should become hidden and have its collision turned off. When the collision volume stops overlapping (event end overlap), the room should reappear and the collision be turned back on.

The collision volume is moved using a Slider in a UMG widget, which passes the float to the player controller:

267602-hud-bp.png

Which then redirects to the pawn containing the volume:

267604-playercontroller.png

The pawn then uses a lerp to update the volume’s position:

The last piece of the puzzle is the room itself, that has the overlap events in it:

If I remove the ‘end overlap’ event it all works perfectly, but as soon as I include the ‘end overlap’ event it crashes giving me the error: ‘An infinite loop has been detected’ BUT it lists the cause as being a ‘Delay’ node in a totally different segment of code that comes off a different event that shouldn’t be being called at all.

I’ve found that this error can sometimes occur incorrectly when the engine reaches 1,000,000 loops, but there isn’t any loops at all in this sequence so I’m all out of ideas as to what has caused it. Any help would be massively helpful as this really is a game-changer (no pun intended).

Thanks in advance!

just from reading your description is sounds like you are turning the collision on and off very quickly and repeatedly. the collision is turned of when the player overlaps right, then you disable collision which would in effect be end overlap. on end overlap you are turning collision back on, so your turning collision back on which would be begin overlap again, which in turn would create a loop.

maybe try having something like begin overlap → disable collision → delay → enable collision. or maybe just put a delay after your end overlap and before the enable collision. in either case a delay would greatly reduce the times that the script is looped which would get rid of the error and crash.

course this is just a theoretical idea.

It would help if we could actually read the code not just a red circle around the area that is the issue…just saying :slight_smile:

I never even considered the ‘end overlap’ event firing when the collision is turned off, sounds feasible, I’ll try another way of doing it, see if that fixes it. Thanks!

Seems like you’re right. Without the collision turning back on it works a charm. I never even thought about the collision being removed triggering the EndOverlap. Thanks for your help.

If you want to drop it in the answers I’ll mark it as correct so you get the credit.