Menu
CoddyTech

Finish Line

Part of the Building Real Games section of Coddy's Unity journey. Lesson 55 of 60.

challenge icon

Challenge

Medium

Make the white gate finish the level and open the next one.

  1. In FinishLine, add using UnityEngine.SceneManagement; and OnTriggerEnter that returns unless the object has a Player.
  2. Log the level's name and complete!, as Level1 complete!.
  3. Load the build index after the active scene's; after the last level, load index 0.

Press Play and cross the finish: Level2 opens. Then Check.

Try it yourself

using UnityEngine;

public class FinishLine : MonoBehaviour
{
    // A later lesson fills this in: the end of the level.
}

All lessons in Building Real Games

Practice on your own: Unity playground