- Home /
Police Flashing Lights?
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.
This sounds like something you can pull off pretty easily with a coroutine. Read this guide: http://unity3d.com/support/documentation/ScriptReference/index.Coroutines_26_Yield.html
Answer by brumdogpro · Nov 26, 2011 at 03:32 AM
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.
Answer by lucashaley · Nov 26, 2011 at 05:01 AM
This might be something you can take care of easily using the Animation Editor.
Answer by sam32x · Nov 26, 2011 at 07:18 AM
instantiate something with a lens flare then destroy it and instantiate again?
Answer by jimmyismike · Aug 03, 2012 at 08:07 PM
You could easily add a animation to the light no coding needed. This is a lot simpler and more efficient!
Your answer
Follow this Question
Related Questions
How to make flashing/blinking/flickering lights? 1 Answer
Police flashing light script 2 Answers
Bumped Specular Terrain flickering. 1 Answer
Dynamic Ambient Light 'Flicker' Effect | Example/Custom Images Inc. 2 Answers
Z-fighting problem. 1 Answer