Download

Health Bar

Hello,
I am new to unreal and i want to ask what is the best way to make a health bar that will take damage and lerp the values.
So that the progress bar percent will slide down slowly and wont be cut down directly (as of big chunks of health dropping).
Should i use some timer or Should i Use the Tick function or is there a better approach?

I believe the simplest solution would be to bind a function to your progress bar’s percent and map your health value to 0…1 range. You can lerp in there.
I wouldn’t really worry too much about performance if you’re simply lerping a value, but you could also use a timer that’s set to fire only when the progress bar needs to move.

I think the first thing you said will work just fine but how does binding work in C++ i only saw it in blueprints.

Sorry, thought I was in the blueprint section. For that, you could just set a timer. I don’t know if there’s some special binding implementation, but just setting values directly in a timer has worked for me with no problem. If you’re feeling even lazier, tick.

Here’s a post I found very helpful with UMG and C++ in general: [TUTORIAL]How I mix UMG and C++](How I Mix UMG and C++ - Unreal Engine Forums)

Thanks man :slight_smile: