Day 80: Sleeping Guard Interaction

Tyler Smallwood
2 min readAug 30, 2021

Objective: Set up the interaction to start the Sleeping Guard Cut scene!

Today will be a quick one on setting up the system to start the Sleeping Guard cut scene. To activate the cut scene we need a box collider to activate the OnTriggerEnter. You can Create a 3D cube and once lined up just deactivate the MeshRender.

For this cutscene we will need to use a new script to activate it and later on use the same script for a win state. In this script we will get a reference to our cutscene.

Since we are using a collider to see if the player is in the area, we will need to use OnTriggerEnter.

We want to make sure that only the player is entering this collider, so we will use the collider variable ‘other’ and compare the tag of the object entering the collider. If it is equal to Player enter the if statement and if not ignore. There are two ways of checking the tag. We can use other.CompareTag(“TagName”) or other.tag == “TagName”.

Using other.CompareTag(“”)
using other.tag

Once we are inside of the if statement we will need to activate the cutscene to start playing. Since we saved it as a gameobject all we need to do is use variable with ‘.SetActive(bool)’.

That is how I dealt with the sleeping guard activation. Thank you for reading and have a wonderful day!!

--

--

Tyler Smallwood

I am passonate on learning to program and use Unity to become a skillful Unity Developer