Stealth Game: Sleeping Guard Interaction

Today, I implemented the ability for the player to trigger a cutscene when near the sleeping guard!

It turned out to be quite nerve-racking! The sequences of game objects on the cutscene had to be edited, in a way, that made it difficult.

But alas, I have relentlessly defeated this problem, and I have learned along the way! Such things that make it difficult are always the best way to learn!

The timeline is still new to me. I am grateful to be in a position where I am learning all of these things I have wanted for such a long time.

So down to the nitty-gritty, I have a trigger collider set around the sleeping guard’s desk.

I created a script that when the player enters the trigger, it will activate the cutscene game object in the OnTriggerEnter() function.

using UnityEngine;

public class GrabKeyCardTrigger : MonoBehaviour
[SerializeField] private GameObject _keyCardCutscene = null;

private void OnTriggerEnter(Collider other)
if (other.CompareTag("Player"))

A short and simple script.

This was the easy part! Editing the cutscene in the timeline kicked my ass. I made it work in the end. It looks like this:

I have learned a lot using the timeline for this project! It’s something every Unity developer needs to know!

I am all set to make future cutscenes for my games. I so eager to make them, but I must be patient!

This project is almost to an end, and I hope there will be more cutscene creations in the coming courses!

That is all for today. Thank you for your time!




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store