Vigyata.AI
Is this your channel?

Make your game feel professional! (Unity 2D Health Bar)

109 views· 2 likes· 3:25· Dec 1, 2025

🛍️ Products Mentioned (5)

#unity #unity2d #gamedev Learn **HOW TO MAKE A SIMPLE HEALTH BAR IN UNITY** for your 2D game in the easiest way possible! This tutorial shows you the fundamental technique using Unity's built-in **UI Image** component and a clean C# script to handle both damage and healing. This is the perfect starting point for any Unity beginner looking to implement core UI functionality. Chapters 00:00 Intro 00:05 UI Image & Canvas Creation 00:15 Setting Image Type to "Filled" (Crucial Step!) 01:00 C# Script: Variables & Setup 01:15 Adding Damage (Decrease) Logic 01:35 The UpdateHealthBar Function 02:20 Testing damage 02:30 Adding Healing (Increase) Logic 03:10 Final esting and Review 🎮 Play my Steam game: https://store.steampowered.com/curator/45606083/ 👍 Subscribe for More Unity Tutorials: https://www.youtube.com/@CasayonaCode 💬 Join Our Discord Community: https://discord.gg/hzg93VwPJe 👑 Support on Patreon (Free Assets!): https://www.patreon.com/c/CasayonaCode ❤️ Check Out My Itch.io Page: https://casayonastudio.itch.io/ 🖥️ Download Source Code & Assets: https://www.patreon.com/collection/961077?view=expanded 📩 Contact Me: casayona.team@gmail.com ❓ Have any questions or need help? Feel free to ask in the comments or join the community. ················································································ #unity3d #unity2d #gamedev

About This Video

In this Unity tutorial, I show you the easiest, most beginner-friendly way to make a clean 2D health bar that instantly makes your game feel more professional. We start from zero by creating a Canvas, then adding two UI Image objects: one for the background and one for the fill. The “magic” step is on the fill image—switching the Image Type from Simple to Filled, setting Fill Method to Horizontal, and Fill Origin to Left. Once you see the Fill Amount slider working in the Inspector, you’ll understand why this technique is so reliable. After the UI setup, I build the logic with a simple C# script (HealthBarManager). I define currentHealth, maxHealth, and a public Image reference so you can drag-and-drop your fill image in the Inspector. Then I add TakeDamage (clamped so health never drops below zero) and the core UpdateHealthBar function, where I calculate the ratio (currentHealth / maxHealth) and assign it directly to the Image.fillAmount. Finally, I test it with simple controls—Space to take damage and Q to heal—so you end up with a fully functional dynamic health bar you can plug into any project. If you want it to look even better, I recommend smoothing the transitions with the math/blur approach I mentioned.

Frequently Asked Questions

🎬 More from Casayona Code