Choosing destinations – respawning to the most recently passed checkpoint
A checkpoint usually represents a certain distance through the game (or perhaps a track) in which an agent (user or NPC) has succeeded reaching. Reaching (or passing) checkpoints often results in bonus awards, such as extra time, points, ammo, and so on. Also, if a player has multiple lives, then often a player will only be respawned back as far as the most recently passed checkpoint, rather than right to the beginning of the level.
This recipe demonstrates a simple approach to the checkpoints, whereby once the player's character has passed a checkpoint, if they die, they are moved back to the most recently passed checkpoint:

Getting ready
This recipe builds upon the player-controlled 3D cube Unity project that you created at the beginning of this chapter. So, make a copy of this project, open it, and then follow the steps for this recipe.
How to do it...
To have the respawn position change upon losing a life depending...