Hi there! I would like to simulate a car turning signal (Right or Left) when I press a key, and it will turn off when I press the key again. Could someone provide me with some help? I have tried Coroutines with WaitForSeconds, but it doesnt work as planned.
A coroutine sounds like a pretty simply way to do it:
- When you press the button, start the coroutine and store a reference to it.
- When you release the button, stop the coroutine using the saved reference, and turn off the light.
The coroutine itself would be pretty simple. In an infinite loop, just:
- turn on the light
- wait some time
- turn off the light
- wait some time
3 Likes
It works! Thank you so much