Make Them See the Player- Game Dev Series 70

Objective: create usable eyes to guards.

The adjustment of guards is almost ready. What we should do next is to make them as a threat to our Player.

In this article, we will create functional eyes to those guards to detect the Player. This function is easier than you thought. It just needs some function that we used before.

Create the “eyes”

First we will need to create the eye to all the guards. In here we will use a box collider to do the detection.
Add a cube to all of guards, and adjust the box collider to a proper position, then remove all the mesh renderer.

Set these colliders to trigger. To make a trigger works, we also need to create a rigidbody and disable the gravity.

Next, create a script named Eyes and attach to guards. Let’s create the function of those eyes.

Scripting the eyes

With this script, when the guards detect our Player, it should turn on the game over cutscene that we created. To do that, create a gameobject variable.

The next part is simple, when it trigger to a gameobject with a Player tag, it should activate the cutscene.

Now back to editor, drag the game over cutscene into the script.

All done! All the guards is on duty now.




A passionate gamer whose goal is to work in video game development.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Upgrading to Jakarta EE 9

Let’s add AWS ec2 instance root user password

How to add root user password to AWS EC2 instance

Branches in Git Bash

ML/Python Code on Docker Container

Understanding Async/Await in C#

Freezing tensorflow model

Freezing tensorflow model

Module Resolution, 25 Hours of Java, More SDKMAN!

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
S.J. Jason Liu

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.

More from Medium

Creating an emission map texture

Creating An Advanced 2D Player Controller Without Any Unity Components! (Part 1)

Day 107: Ladder System Part 1

Instantiate and Destroying game objects in Unity