I’m making a game and I’m adding emergency vehicles. I don’t want the rotating ones, I need the actual flashing ones. I have textures for the actual flash. All I need to know is how to make it wait for seconds enabling and disabling with a loop.
public IEnumerator flash() {
renderer.enabled = true;
yield return new WaitForSeconds(.5f);
renderer.enabled = false;
yield return new WaitForSeconds(.5f);
}
Something like this but with a little editing should work for flashing lights. This is basically how I did it for my red suicide bombing enemies.
This might be something you can take care of easily using the Animation Editor.
instantiate something with a lens flare then destroy it and instantiate again?
You could easily add a animation to the light no coding needed. This is a lot simpler and more efficient!