Creating Security Cameras in Unity

First create a script for the security camera so that we can create a behaviour for the camera

Inside the script, add a reference variable which will start a gameover cutscene when it detect the player.

Create a coroutine so that the game waits for half a second before the cutscene starts to give enough time for camera to display that it has detected the player by changing the camera ray color.

Now create a trigger enter function which detects when player enters the collider then sets the player to inactive, changes the color to red, sets all the security guards to inactive and disables the animator so that camera stops rotating.

You can also animate the camera by rotating the value in y-axis.

--

--