Healthbars disappearing when ai goes offscreen

Hi everyone!
Can anybody guess what’s happening here?

62177-healthbarbug.gif

The blueprint scheme consists on a character blueprint (enemy) containing a reference of the widget blueprint (healthbar). The enemy blueprint creates the widget during the EventBeginPlay as follows:

And the healthbar widget graph looks like this:

I’ve tried adding the widget to viewport every tick (on the enemy blueprint) but it didn’t work (the isInViewport boolean always returns true).
I would try to fix this in a patchy way, but I don’t even know what originates the problem.

Any help provided would be appreciated!

Still happening, if anyone could provide any sort of help or clue it would be inmensely appreciated!

Did you try to make a 3D widget in world, and make that appear over the head of the AI facing the camera all the time? That way even if you go off-screen it should stay in location.

Not sure if I understand you, isn’t that what I’m doing in the blueprint?
Or do you mean literaly drag a widget to the level and link it with the enemy via parameter?

If it’s just the healthbar you want (no text, names etc.) it would be more practical to use a billboard material. You can create a healthbar in materials by using a linear gradient and clamps.

Problem is I interact with the healthbar on hovering and click (and not only by doing so on the healthbar itlself but on the actor too or even other actors).
I’m sure all of this could also be done with billboard material as you state but I’m more interested in knowing what causes this more than changing the implementation. Thank you by the way!

It seems Event Tick stops getting called when it goes off-screen in 4.9. Workaround is to have all your Event Tick functionality called on a timer instead. See Widgets are disappearing - UI - Unreal Engine Forums

Yeah! that was it. As you point, it is problem with EvenTick not geting called when the widget was offscreen.
I swaped the EventTick node with a custom event (called “Update”) and call Update from EnemyBP EventTick.
This method is even better than the original EventTick (assuming it worked) because you ensure that the Widget will not operate when you destroy the actor that “owns” the healthbar.

Again thanks a lot jaragoondoo and best wishes of luck for your projects!