To have the respawn position change upon losing a life, depending on the checkpoints that have been passed, follow these steps:
- Move the Cube-player GameObject to Position (12, 0.5, 0).
- Select Cube-player in the Inspector window and add a Character Controller component by clicking on Add Component | Physics | Character Controller (this is to enable the OnTriggerEnter collision messages to be received).
- Create a cube named Cube-checkpoint-1 at (5, 0, 0), scaled to (1, 1, 20).
- Create a CheckPoint tag and assign this tag to Cube-checkpoint-1.
- Duplicate Cube-checkpoint-1, name the clone Cube-checkpoint-2, and position it at (-5, 0, 0).
- Create a sphere named Sphere-Death at (7, 0.5, 0). Assign the m_red material to this sphere to make it red.
- Create a Death tag and assign it to Sphere-Death.
- Duplicate Sphere-Death and position the clone at (0, 0.5, 0).
- Duplicate Sphere-Death a second time and position the second clone at (-10, 0.5, 0)...