Checkpoints

Tutorial

·

Beginner

·

+10XP

·

60 mins

·

(202)

Unity Technologies

Checkpoints

Checkpoints are a common element of most modern games. They allow the player to save their progress, so that if they die, they respawn back at that checkpoint.

Languages available:

1. Find the Checkpoint

There’s a Checkpoint Prefab in the GameKit 3D Lite. To find it, go to 3D GamekitLite > Prefabs > Utilities > Checkpoint.

The Checkpoint is invisible, and Ellen triggers it by walking into the Collider area (the green wireframe box). To ensure that the player knows that they have triggered a checkpoint and knows where they are going to respawn, you should use a visual cue in the game to illustrate that Ellen hit the checkpoint.

In this example, we are going to add another Crystal to the Scene, and set it up so that it activates when Ellen touches a Checkpoint. To do this, we need to place a Crystal and a Checkpoint, and then set the Checkpoint up so that when Ellen touches it, it sends a Game Command to the Crystal.

To add a Checkpoint:

  • Drag and drop the Checkpoint Prefab into the Scene and place it to ensure that Ellen can touch the Collider.
  • Resize it to make sure it only covers the area you want to include.

In the Inspector window, Set the Layer setting to Checkpoint.

Go to 3D GamekitLite > Prefabs > Interactables and drag a Crystal Prefab into the Scene. Place it near the checkpoint area and rename it to CheckpointCrystal.

  • To link the two GameObjects, select the Checkpoint.
  • Select Add Component.
  • Add Send On Trigger Event (type it in the search box to find it).

Apply the following settings to the Send On Trigger Event component:

  • Set Interaction Type to Activate.
  • Set Interactive Object to GateCheckpoint via the GameObject selection.
  • Enable One Shot.
  • Set Layers to Player. This allows the play character (Ellen) to collide with the area.

To verify the connection between them, select the CheckpointCrystal, view the Inspector window to check that the Game Command Receiver has Checkpoint listed in the Senders list.

To test the checkpoint, press Play and walk into the Checkpoint. The CheckpointCrystal now should activate. Next, test what happens if she dies. She should respawn in the center of the Checkpoint volume.

Complete this tutorial