Game Dev: How to Make Health Bars in Unity From Beginner to Advanced

Track health, mana, timers, cooldowns, and more by making health bars for your entities in Unity. Let’s look at two methods.

Dusk Sharp
The Startup

--

Borderlands 2 is one example of a game with interesting and effective UI.

Oh no! Your health is low — find a health potion, gold coin, or med-pack!

Almost every video game has an abstraction for health, and consequentially a means of displaying it. Even the least gaming literate people know what a health bar is — you know, that menu UI item at the top of your screen that shows how much health, or mana, or whatever else you have left.

Putting the debate of whether health bars are overused or not aside, if you do decide to implement a health bar, you need to make sure it appropriately conveys what it needs to convey. Some best practices include:

  • If you have multiple health bars, color code them. Typically, players will attribute green (or red) to health, blue (or purple) to magic power, and yellow (or orange) to a timer
  • Make sure the colors stand out against the background and chaos of the gameplay. A good way to do this is by implementing an outer layer to the health bar (which we will get into)
  • Bound your stat bar so it does not go outside of valid bounds. No one wants…

--

--