Hi im having some problems to make a delay between the instantiation of particles. When i play this script Unity waits 2 seconds but then the particles are instatiated almost inmediatly. What im doing wrong?
var exp: Transform;
var on: boolean = true;
function fire()
{
Instantiate(exp,transform.position,transform.rotation);
yield WaitForSeconds (2);
Debug.Log("End");
}
function change ()
{
Debug.Log("Start");
yield StartCoroutine("fire");
}
function Update () {
if(on)
{
on = false;
change();
on = true;
}
}