Fade to black on player death.

Hal Brooks
3 min readNov 21, 2021


Objective: Create short cutscene when player dies.

Screen fades to black with brief message before returning to the main menu on player death.

Create a new game object named Cutscene to hold the various fade to black effects. Create another empty game object named Oubliette. Add a timeline from Unity window > sequencing menu, saving in the Timelines folder.

Oubliette cutscene

Add a UI Canvas to Oubliette, allowing it to scale with screen size with a 1920x1080 resolution.

Canvas setup.

To the Canvas add a UI Image, Fade_To_Black_img, adjusting the color to be black (0, 0, 0, 0). Set the anchor points to be stretch-stretch for the rect transform and zero its position. The animator will be added later through Unity timeline.

Fade_To_Black_img for the Canvas.

Next add a UI text object, and set up as shown below. Adjusting the color, the text message and the font size and positioning. The animator will be added later through Unity timeline.

Text setup.

The hierarchy should appear as below.

Game hierarchy window.

Install Cinemachine from the package manager if not installed. Select Oubliette object and open the timeline window. Add the main camera to the timeline, which should have the CinemachineBrain, to add a cinemachine track. Next add animation tracks for Fade_To_Black_img and Text. For each record the color alpha to be zero at 0 seconds and 255 at three seconds. Select Oubliette when finished and inactivate it by unchecking the box next to its name. The cutscene should start inactive.

Oubliette timeline.

On the Player script create four new variables using SerializeField to assign them in the inspector, shown below. One of these will hold Oubliette cutscene reference.

Variable assignment in Player script.

Add an OnEnterTrigger2D to the Player script as shown below. There are two types of Oubliettes in game, the Oubliette2 is shallower, thus can be escaped if the player has Boots Of Flight. If the Player is triggered by an Oubliette, the Oubliette cutscene is activated, and the player is returned to the main menu after 5 seconds using the ReturnToMainMenu coroutine.

OnTriggerEnter2D method in Player script.

The Oubliettes are empty game objects with a box collider 2D with is trigger checked. The box colliders are adjusted for each Oubliette, as shown, and tagged Oubliette for 1 , 2 & 4, as these cannot be escaped. Oubliettes 3 & 5 are tagged Oubliette2 as if the player has boots of flight escape is possible.

Green frames show the Box Collider 2Ds for the Oubliettes in the game.

Cutscenes for player death due to monsters or falling or escaping the dungeon can be created with a similar approach.