Hai! This seems to be a problem a lot of people have, but none of the solutions I looked at seemed to help. Pics below of blueprints. Basically, I am wanting a loop to run until a mouse button is pressed, and this seems to trigger an infinite loop. am I simply exceeding the number of iterations the game thinks are appropriate? If I false the while loop, it exits properly and program continues. If I add the mouse button press detection, it crashes and returns infinite loop.
This is a bad design. What happens is that at every tick, the while loop is executed and since the conditional variable is not set in the body, an infinite cycle happens.
If you need to update the location until something happen, use a Timer, a Timeline, the Tick function, …
To use a timer, do you put it in the while loop? Because I tried that and it still returned an infinite loop. If I start stacking things for detection in the event tick, won’t that cause performance drag?
Your edit perfectly explained what I was missing. Thanks so much!
There is nothing wrong in using Tick. The problem is when people start doing a lot of expensive operations every tick. The cost of something as simple as a branch and some transforms operations is virtually negligible.
This is what I changed it to. Not totally finished, gotta set it to only run the operation if there is something in the variable, but this works without the loop, just with “null variable” errors.