ASYNCH LOOPS (or how to flash a light?)
-
Let’s say I have an object that I want to flash off and on a certain number of times (like a strobe light) which I will do by cycling the visibility of the object.
The normal logic would be to loop x number of times, turning the visibility of the object off, waiting some time, and turning it back on again, and waiting again for a time before proceeding through the next iteration of the loop (as in the example below on the right, which doesn’t work). Instead I get to see just a single iteration of the light turning off and back on again. I am guessing this is due to asynch behaviour.
So instead, I need to resort to a convoluted behaviour as seen on the left in the example below (and that’s just representative of flashing 3 times) - so the example on the left achieves what I want but is convoluted. The example on the right is the approach I would prefer to take, but doesn’t give me the result I want. Any suggestions?