So, I tried making a health bar with the UI slider, and I ran into a few problems. For one, the health bar doesn’t completely disappear, it just gets mostly depleted. And for another it kinda juts out the edges of my background? Is there any way I can use the background as a mask so it never leaves it?
This is what it looks like fully depleted,
And here’s another picture of it mostly depleted, jutting out from the background,
But if it’s full it matches perfectly with the border.
Any help would be appreciated, thanks!
-
Remove the “Fill Rect” reference from from the Slider (set it to “None”)
-
Set the Size of the Fill to the state when filled completely (e.g. by clicking on the Anchor Presets and selecting the lower right option during holding the Alt key)
-
Change the Image Type of the Fill ti “Filled” and then “Horizontal”
-
Back in the Slider add a “On Value Changed” event
-
Drag the Fill into the object field of the event
-
Select “Image” → “fillAmount” (from the upper part with category “dynamic Float”)
This should work.
But since it is a health bar you probably don’t need the slider at all and only do step 2 and 3. When using a slider you can change the value by dragging on it with the mouse…
1 Like
I got it figured out now, thank you so much!