How to make a QUICK and SIMPLE health bar in Unity!

Опубликовано: 26 Апрель 2026
на канале: PineappleDev
176
9

Code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class HealthBar : MonoBehaviour
{
float startHealth;
public float health = 100f;

public Image healthBarImage;

void Start()
{
startHealth = health; //we use start health to calculate the fill amount of health bar
}


void Update()
{
healthBarImage.fillAmount = health / startHealth;
}
}




Check out my games here! https://gamejolt.com/@Cringeyy/games
If you would like to support me you can donate to my cashapp $cring47 Anything Helps ❤❤

Twitch:   / cringeypineapple  
join the discord?   / discord  

HAVE A GOOD DAY :)


Making a game, game creation, creating a game, making a Roblox game #shorts #developer #gamedev #gaming #unity #games #newgame #workfromhome #videogames #gamedevelopment #indiegame #indiegamedev #indiegames #indiegame #karlson #dani #amongus #rust #raid #fullmetal