var numberTimesDead:int = 0;
var timesCanDie:int = 1;
function Update() {
if(numberTimesDead == timesCanDie) {
Coro();
}
}
public var b : bool = false;
public function Coro() {
if (!b) {
b = true;
yield WaitForSeconds(1);
Application.LoadLevel(0);
}
}
This should do the trick, I must admit it has been some time since I programmed in unityscript. As far as I remember you should have to call the coroutine with StartCoroutine as in C#, but if the above doesn’t work it should be