My journey becoming a Unity game developer: Security Cameras-Activating the Game Over Cutscene

Rhett Haynes
3 min readNov 13, 2021

--

Objective: Activate the game over cutscene when the player collides with the camera’s light collider. Also, hide the Darren game object from appearing in the cutscene showing us 2 Darren’s instead of one.

Player being spotted by the lights and captured cutscene plays afterwards.

When the security cameras lights shine on Darren, we want to trigger the game over cutscene. Create a new script name Security Camera. Create a new variable name gameOverCutscene that will hold the Game Over Cutscene game object. Then use the OnTriggerEnter() function to find out IF the other game object the lights collide with is the Player object. If so, set the gameOverCutscene to be active.

Trigger game over cutscene.

Attach this script to both Camera Cone game objects inside of the 2 Camera_1 objects. The Camera Cone objects represents the lights coming out from the security cameras. Make sure the Mesh Collider’s Is Trigger is turned on to allow the Player object to walk into the lights.

Game over cutscene game object added to the 2 security cameras.

One other thing, attach Rigidbodies to both Camera Cone game objects to allow the Player object to be recognized by the cameras colliders. Also, turn off the Use Gravity setting as well.

Rigidbodies needed for the player and cameras colliders to trigger.

As we play the game, when the player is caught by the lights, the cutscene is activated. However, as the cutscene plays we will notice that a 2nd Darren is in the scene. The Player object is still active in the game even though we’re watching the cutscene.

Game over cutscene activated when player collides with the camera light cones, but we have 2 players onscreen now.

To fix this quickly, open the Timeline editor using the Game Over Cutscene game object. Create a new Activation Track and drag the Player game object into its slot. Place the timeline pointer at the end of the Active track’s position, and drag the beginning of the track’s position to the end where the pointer is located.

Play the game now and see Darren captured when he walks into the lights, and the cutscene plays without the original Darren Player game object appearing in the cutscene.

Activation track added to remove the extra Darren player from the cutscene.

Next time we will change the color of the lights when Darren is caught.

--

--

Rhett Haynes
Rhett Haynes

Written by Rhett Haynes

Learning to become a Unity game developer.

No responses yet