Character Respawn


Currently in my game, I have the character respawning back to life in the exact same spot at the start of the game. But lets say the character makes it midway of the game and dies. How do I get the character to respawn midway of the game?

Here is the script Im currently using for character respawn.

private var StartPos : Vector3;
function Awake()
           StartPos = transform.position;
           function OnTriggerEnter(other : Collider)
            if( == "fallout")
            HealthGui.LIVES -= 1;
            StartPos.y += 4;

              transform.position = StartPos;

Why don't you setup a midway trigger object, and when the character hits the trigger you can change the value of your Vector3 that is the start position to the position of the trigger object. This way you are effectively just moving the spawn point to the middle of the level instead of the beginning.