Hi, i’m trying to make the main scene of my game restart after my character dies.
But my script just won’t work.
It is attached to the trigger on my character head, and is in the same script that makes my character die.
What should i do to make it work?
Here it is:
var explosion: Transform;
-
function Start () {
}
function Update () {
}
function OnTriggerEnter (otherObject: Collider)
{
if(otherObject.gameObject.tag == "FallingObject" )
{
Destroy(GameObject.Find("First Person Controller"));
var tempExplosion: Transform;
tempExplosion = Instantiate(explosion,transform.position,transform.rotation);
yield WaitForSeconds(2.0);
Application.LoadLevel(1);
}
}