UMG(healthbar) following actor problem

Greetings,

I have made a UMG to follow a moving enemy(healthbar), the problem is when I(the player) move, the UMG moves along with me. It’s like it struggles to keep its screen location over the enemy. Any ideas how to fix that? I’m using a loop I made to call SetPositionInViewport. I tried to remove the UMG’s canvas panel, but that didn’t help. Any help would be highly appreciated.

Thank you in advance!

Try to attach your widget as a widget component.

This was actually the first method I used to realise the healthbar, but I had to make it always face the player and it got a nasty rotating effect. Isn’t there a way to fix the problem without creating a widget component?

With the widget component, you have two methods to ‘attach’ it: world or screen. Choose screen.

You can fix the “nasty rotating effect” by limiting its rotation to always face the camera, no pitch rotation (fixes the rolling effect).

I set it to screen and everything works fine now. Thank you!