Reset Player Position After Losing a Life

I have a question about player position after losing a life. For example, if a player is destroyed and loses a life, how can I reset the position of the player? I would like to know how to reset the player to its original position of the game when the player is destroyed or steps out of bounds. Can someone show some sample code please?

This would be a good time to learn how to use the Unity Script Reference:

Every Game object has a transform, and every transform has a position, which you can set. So do a search for transform and they will have some sample code. You can call the transform of the game object the script is attached to by using “transform” with a lower case.

I would look at the docs as fire7side said. You pretty much want to set a variable as the players transform, then on the death function set his transform back to that variable.

So something like this would store the starting position of the enemy. (note; I’m just winging it and haven’t tried this script, but I assume it would would)

private var origpos : Vector3;
origpos = transform.position;

NOTE: The above would probably be good in a function Start while below would be good in the update within an if statement.

This would store the position in the private var “origpos” and later when you wanted to restore the player to his spot, simply do the opposite.

transform.position = origpos;

when ever restart my game form lastcheck point player is deid by it self