Health bar not updating correctly

I found a small bug to where if any of the pawns and characters in my game, the health bar doesnt update right away although they are clearly taking damage. Is there any way i can fix this?

How are you calling the widget update?

  • a bind delegate
  • an update via the character on take damage
  • direct bind in ui widget (worse option performance-wise)

Is it single player or multi player?

its a single player game and it updates when player or enemy takes damage

Are you using hit or overlap events to register the hit?
Have you tried putting a breakpoint on the update function (your set health bar function) inside the widget to see if it triggers with a delay?
Does a print string register the health to screen reliably?

I added the breakpoint where it updates but it goes to the point as soon as i press play. I thought adding more damage and health to the main character and the enemy would solve it but its just the same issue but with bigger increments.

This is how everything is updated

you are not setting anything after the update function. The passed variables need to set your top progress before you use it. Otherwise it never changes (unless you are changing it in another function making the input pin redundant)

So i should set the boss or my health at the end of the update?

Also, i dont know if this would help but this is the video tutorial i got this set up from.

Ideally you would only need to pass in the current value and max value if the needed update and then update the ui accordingly.

so like this correct?

the nodes for those are being used farther down the code so thats why they arent connected

I don’t know if this makes sense, but when i was looking at how the enemies hit the character, the health bar works well but its when the main character hits the enemies that it has that small update delay