hi,
I want to create something like this energy bar in this picture, but the maximum size is dynamic, for example max health is 60 and i want 6 square, and when max health is 100, i need 10 square. i don’t know how to implement this, should i make material and custom progress bar?
Hey there,
- You’re going to want to start off by
making a custom UMG widget for your
health interface. - Once you get that ready, add a
horizontal box in the Designer tab in the position you’d
like your ‘Health Bar’. -
Add multiple images to the
horizontal box, and space them as
you see fit. -
Use the UMG’s graph to toggle these
images to simulate gaining and
losing health by communicating with
your character’s health variable in
the character blueprint.
Hey Smith,
Off the top of my head, I don’t know of any other way to easily get what you’re looking for. A UMG widget should be sufficient though.
The health bar that I outlined above is dynamic. You can add 10 images (10 health squares) to a horizontal box. You would then use the widget’s graph tab to toggle the visibility of these images according to how much health you have.
For example:
- Your character has 100 (Max) health.
You would display all 10 squares of
health in your UMG widget. - You get hurt down to 60 health. You
would hide the last 4 squares of
health to match that.
hey mookiez,
thanks for your answer.
do you have other idea for this, because i want to create health bar that max health is dynamic and if i have 100 for max health, i need 10 square. and 60 health, just 6 square.