- Home /
I want particle to emit for one second after my mouseclick
Whats wrong with my code? Someone please tell.
var nextFire : int = 1;
var end : int;
function Update (){
if(Input.GetButtonDown("Fire1")){
end = 1;
transform.particleSystem.enableEmission = true;
}
if(end > 0){
end = nextFire - Time.deltaTime;
}
if(end <= 0){
transform.particleSystem.enableEmission = false;
}
}
Comment
Answer by brycem24 · Sep 03, 2014 at 10:39 PM
My guess would be because end has absolutely no relevance in your code. Right now the particle system is enabled when you click it this is because end does not affect it. You could do if(Input.GetButtonDown("Fire1)) if(end >= theconditionyouwanttheparticletoplayon) { transform.particleSystem.enabledEmission = true)
Your answer
Follow this Question
Related Questions
How to set timer for WWW helper? 1 Answer
C#: Making a timer 1 Answer
How do you save timer with PlayerPrefs? 1 Answer