- Home /
Delay light on held down button
Hello beautiful answering community! Once again, could be a noob question from a beginner in coding, but I'm trying to program a fireball to appead when the right mouse button is held down. I managed to do that, and when the right mouse button is held, the particle emitter and light source appear. However how would I script the light to be delayed a few seconds? (The light has a different script to the flames) This is the script for the light:
function Start () { light.enabled = false; }
function Update() {
if(Input.GetMouseButtonDown (1))
light.enabled = true;
else if (Input.GetMouseButtonUp (1))
light.enabled = false;
}
Thanks in advance for your help! :)
Your answer
Follow this Question
Related Questions
Add delay in while loop 1 Answer
How to implement a delay between each time my gun fires (using coroutines or otherwise)?... 2 Answers
android audio delayed 1 Answer
cooldown timers 0 Answers
Shoot Bullet Delay Enemy 0 Answers