Lives and Respawns

Going over how I implemented lives and respawns in my 2.5D game

Objective: Creating the lives and respawn system for my 2.5D game.

The Functionality

To get things going, the first thing I did was create the UI to represent our lives, as well as hooking up that UI to my UIManager.

Code in my UIManager class

I call these methods through my PlayerController script as needed. With this hooked up, I then created an empty GameObject and named it RespawnPoint. This will serve as the position our player respawns at when they fall off the platforms. With that, I created another empty GameObject and gave it a BoxCollider with IsTrigger set to true. This GameObject was named DeadZone and I set it up below all of the platforms.

The green highlighted edges are the box collider of the DeadZone GameObject.

On this object, I also attached a custom C# script with an identical name. I used the following code to implement everything.

With all of this working together, I get the following result:

That’s all for today! Thanks for reading!




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

Recommended from Medium

Encode x Polygon: Polygon Technical Workshop (Europe + Africa) [Video + Slides]

Scan a Video for NSFW Content in Java

Introduction to Vim buffers


Animating Sprites in Unity

Creating a Shield Damage Feature Using the Alpha Color of a Sprite in Unity — Part 01 (Setting the…

How to use Retool with AWS Amplify (AppSync and Cognito)

UNITY 3D REPLICANICS: Replicating Steam’s Collectible Card Display Mechanic — Part II

Scrum adventures of a junior developer

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
Gabe Gomez

Gabe Gomez

More from Medium

C# scripting in Unity — Day 01

2.5D Platformer: Moving Platforms

Bug Fix on Model Flip

Day 102: Character Animation Part 5