Sign in

Gabriel Perez

Today, I added the ability to collect coins!

Each collectible game object has a coin script attached.

Today, I implemented the ability to double jump!


We want to jump when pressing the space key.


I want the player to jump with out the use of a rigidbody. So I need to create the logic for gravity as well.

With the character controller script in use from Unity, I can use it’s “isGrounded” property to check if the player is touching the ground or not.


In the player script, I added some variables.

[SerializeField] private float _gravity = 1.0f;
[SerializeField] private float _jumpHeight = 8f;
[SerializeField] private bool _canDoubleJump = false;
private float _yVelocity;

I want to store…

Today, I created a loading screen with asynchronous operations that will load the next level before entering!


With the main menu and a game scene already made, I want to have a loading scene in between to load the game scene before switching to that scene.

How I did it

I created a new scene and named it “LoadingScreen.” This houses a background image with a progress bar made up of UI elements.

First, I created a background image for the scene, adjusted it to fit into the screen, and anchored it to stretch.

What is a singleton pattern? What are managers? Let’s have a look!

Manager Classes

A manager class represents a script that manages objects or data of a specific game element, similar to how a manager of a company would manage staff for different departments.

For instance, the GameManager script will control the state of the game. The AudioManager script will control the sound of the game. The SpawnManager will control how spawning of game objects.

Singleton Pattern

The singleton pattern is a commonly used design pattern. It allows for one instance of a particular class. They work well for Manager type classes.

Instead of…

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. …

Creating logic for security cameras is very simple! Let’s have a look.


We want the camera to rotate back and forth at a 45-degree angle. We also want the camera to detect the player.

Security Camera Game Object

We want to select the game object with the camera mesh.

Darren can now throw a coin to distract the guards!


We want the player to toss a coin with the right mouse button to distract all guards.

Setting up

If we right-click, then we want to instantiate a coin at the position of the mouse cursor.

if (Input.GetMouseButtonDown(1))
var mousePos = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit _hit;

if (Physics.Raycast(mousePos, out _hit))
Instantiate(_coin, _hit.point, Quaternion.identity);

Since we want to store the location of where we click on the floor, we want to shoot a ray cast from the camera’s position and store it in a variable of type RaycastHit. …

There are many ways to let your A.I. see. I’ll go through the easiest way to do so!


We want our agent to detect the player when in front. If the player is detected, we then want to enable the “Game Over” cutscene.

Trigger Collider

There are many ways to go about this. The easiest way is to use a trigger collider!

Trigger Colliders is a collision detection system without physics. It enables objects to pass through a game object.

To detect a collision, a rigidbody component must be present on either game object. The player and the guards are already set…

Let’s make our AI smarter when navigating around objects!


As a follow-up to my last article, I will show you how to have your player or AI move around objects on the nav mesh system.

Unintelligent Agent

If we were to move in its current state, the agent passes through objects. We don’t want that! It’s not logical for what we want. Here’s an example of our unintelligent agent.

Gabriel Perez

Hello everyone, My name is Gabriel Perez, I am a Unity Developer and a creator who is always learning and experimenting.

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