Triggering the Sleeping Guard Cutscene
Activating the Guard Cutscene along with hiding playable character
Following the similar setup as the Security Guards and Security Cameras, we are going to set up an Trigger point for the sleeping Guard to play the sleeping guard cutscene.
The script:
Using the same modular approach to the script, we are going to use an Serialized Field or public game object to create a handle for the desired cutscene. Then have an On trigger enter method with an If statement to check for the player tag. If player collides with the trigger point, we will set active the cutscene.
Hiding the Player & Security Guard:
Now that we have the cutscene playing, it is time to remove the player and standard guard from the cutscene. Similar to the security camera, we will be using the timeline and an Activation track to control the appearance of these two game objects.
Drag in the two objects into their slots on the timeline and place the activation state at the very end of the cutscene.
Back in Unity, you are going to drag in the proper cutscene game object into the slot in the script component. Then make sure that the collider has an rigidbody and the “Is Trigger” within the box collider element is checked on.