I’m working in Unity utilizing Visible Scripting – however am wanting right here for basic recommendation for looping algorithms!
I made a Whereas loop that continues so long as a boolean glowactive is true. It is below a “On Enter State” that has coroutines enabled.
Then the code enters 2 separate For loops, that go from 0 to twenty and again once more. (Really it goes from 0 to 1 in 0.05 increments, however it’s the identical thought.)
The loop runs so long as glowactive is true… however glowactive is not modified within the loop. Nonetheless, it may be modified in different elements of the code. I learn although that it is best to by no means have a Whereas loop with a situation that does not change contained in the loop… or you’re going to get an infinite loop. That might be true, as a result of I’m certainly getting an infinite loop!
Any recommendation on how you can correctly setup loops to realize my objective? I mainly need to repeatedly differ the _GlowPower from 0 to 1.0, by increments of .05. This makes the textual content glow on and off.
It really works for about 2 cycles or so, after which stops… then it locks up in infinite loop.
I’m not positive how you can construction the code in order that it loops _GlowPower from 0 to 1.0 after which again to 0, time and again… till one thing occurs outdoors of this code which causes glowactive to grow to be false. I’ve learn up on the totally different sorts of loops, however one thing is not clicking as a result of nothing I’ve tried has totally labored. (I can simply get the glowing impact to cycle twice, however then it stops.) Please advise!