How to Make A Simple HEALTH SYSTEM in Unity @BMoDev
How to Make A Simple HEALTH SYSTEM in Unity  @BMoDev
Uploaded March 2021 | Updated November 2026, 3 days ago
🍍 In this Unity Tutorial we'll be setting up the absolute basic essentials for a generic Health script which will allow of us to set a Max Health and Take Damage as well as Heal.

The Health script can be used on Players, Enemies, GameObjects, whatever you want!

This is a follow up to the Health Bar Tutorial (link below) I've done in the past, as there were more than a few comments about how to setup a Player Health Script.

I figured this would be a good opportunity to showcase that. Since people we're struggling to get a relatively simple script setup themselves, I didn't want to go too far into adding more features to the health script and risk the tutorial becoming too complex.

With that said, PLEASE COMMENT if you have something in particular you'd like me to cover, I'd be happy to make a video on it.

Link to HEALTH BAR tutorial: youtu.be/WPxWlYREzJI

Link to Damage Popup tutorial: youtu.be/lKEKTWK9efE

✨Want to support the channel?
Buy me a coffee ☕: ko-fi.com/bmoli

➤Join our DISCORD SERVER: discord.gg/g9j8yrHTED
We have channels to help you with your problems!

➤SUBSCRIBE to learn more game dev

Summary

To setup a health script is rather simple. We just need to track 1-2 variables. MaxHealth and CurrentHealth. These can be integers or floats or whatever datatype you prefer.

As a good rule of thumb I like to set my CurrentHealth = MaxHealth in my Start method, as this makes it convenient when testing in Play mode.

For TakeDamage we simply need to subtract a damage amount you determine from our "CurrentHealth" variable. We then add a check if the CurrentHealth is less-than-or-equal-to 0, in which case...we're dead ☠

For Healing, the opposite occurs, we add to our CurrentHealth an amount you determine. We then check to see if its greater-than our MaxHealth, and if it is, we set CurrentHealth = MaxHealth to cap it. This step isn't needed if you do not have a MaxHealth in your game.

That is basically it! You can now use this script and add to it to spice it up by using Health Bars, Animations, Particles, Effects, Sounds, etc.

Thanks for watching!

#bmo #unity #tutorial
How to Make A Simple HEALTH SYSTEM in UnityI Made A Game Within 48 HOURS | Ludum Dare 46Make the cube JUMP! | Day 12Quick and Easy Unity Debugging BasicsMaking A Game in C With RaylibBasic Saving and Loading in Unity with PlayerPrefsUnity 2D Magnet / AoE Pickup CollectiblesAdding an illuminati pyramid that shoots Eyeballs? | Day 19Test Multiple Phones with Unity Device Simulator!How to Make A Simple Tooltip in Unity TutorialSuper Easy DRAG and DROP Unity TutorialYour Dumb Comments Turn Into a Game? | Day 1
BMo Dev |

How to Make A Simple HEALTH SYSTEM in Unity

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER