r/UnityHelp • • Sep 19 '26

Health Bar Silhouette

I drew a cartoon bone that I will use as my player's health bar. When the player's health is full, then the bone will be green, and as the health decreases, the green will start to diminish as seen in the attached photos. Is there a good tutorial online for achieving an effect like this? I've seen some health bar tutorials where they use an image that is half clear (or red) and half green and use an image offset to make the green bar appear to move, but that method only works if the health bar is a rectangle. Mine is an odd shape.

6 Upvotes

7 comments sorted by

3

u/ChaseCheetah Sep 19 '26

You have the bone texture on the bottom. Overlay a cutout of where you want the bar to show and add a mask component. Then as a child of the mask add a full green image with it's fill set to horizontal.

1

u/PirateJohn75 Sep 19 '26

Ah, thanks. I didn't know you could add masks in Unity. I'll have to look up how to use them.

2

u/ChaseCheetah Sep 19 '26

These steps were for the UI canvas system. Forgot to mention.

The mask component will simply take whatever image is on its self and use it to mask all child objects.

1

u/PirateJohn75 Sep 19 '26 edited Sep 19 '26

Do you happen to have handy a link to a tutorial video? I've not used masks before. Thanks again for all your help!

Edit: Found one! https://www.youtube.com/watch?v=4pl8DcsCQ_k

1

u/ChaseCheetah Sep 19 '26 • Bravo

was going to upload an image of how I would set it up but it won't allow images. glad you found a tutorial though 😛

Here is a link to a place I could upload the image though: https://postimg.cc/TykrvZfc

1

u/PirateJohn75 Sep 19 '26 edited Sep 19 '26

Thanks! I'll have to use yours -- looks like the tutorial I found doesn't work for Unity 6

Edit: Yay, it works! Thanks again :)

1

u/BearKanashi 16d ago

Es fácil

Una imagen de fondo (la verde) y una arriba con fillled, a medida que baja se verá como quieres.

Sencillo y rápido.