I am working in Unity using Visual Scripting - but am looking here for general advice for looping algorithms!
I made a While loop that continues as long as a boolean glowactive is true. It's under a "On Enter State" that has coroutines enabled.
Then the code enters 2 separate For loops, that go from 0 to 20 and back again. (Actually it goes from 0 to 1 in 0.05 increments, but it's the same idea.)
The loop runs as long as glowactive is true... but glowactive isn't changed in the loop. However, it can be changed in other parts of the code. I read though that you should never have a While loop with a condition that doesn't change inside the loop... or you will get an infinite loop. That may well be true, because I am indeed getting an infinite loop!
Any advice on how to properly setup loops to achieve my goal? I basically want to continuously vary the _GlowPower from 0 to 1.0, by increments of .05. This makes the text glow on and off.
It works for about 2 cycles or so, and then stops... then it locks up in infinite loop.
I am not sure how to structure the code so that it loops _GlowPower from 0 to 1.0 and then back to 0, over and over... until something happens outside of this code which causes glowactive to become false. I've read up on the different kinds of loops, but something isn't clicking because nothing I've tried has fully worked. (I can easily get the glowing effect to cycle twice, but then it stops.) Please advise!