Widget blueprint variable lose its reference

Hello everyone,

I’m working on a rts like GUI, and I have created a widget component with a widget blueprint which display a health bar and a shield bar on the top of the unit (In 3d in the scene).
Then I set a unit reference to the widget blueprint, which I use to keep the bars updated.

It’s working, but I don’t know why since I have upgrade the project to the 4.7.4, sometimes my widget blueprint loses its reference to the unit during the runtime (which is only set at the creation of the component) and cause the bar to not be updated anymore.

I have no error except the null reference on the unit variable.

Does anyone have some clues about why my widget blueprint loses the reference on the unit during runtime ?

Thank you

Can you show your scripting please?

Narg

Thank you for the reply.

So here’s the Widget blueprint with the update function.
And the initialization function where I set the Unit reference.

Thank you !

I have done a few more testing, and I believe the problem is that the widget component is “resetting” at some point. it disapears for a short period of time, and is rebuilt with all its parameters at default value.

If I add a debug in the Construct Event on my widget blueprint, it’s indeed called several time during the play.
I use my widget component as a billboard, and during the tick event I scale it, rotating it, and update its position over the unit, but it’s never destroyed.
I have try to change the space to render from World to screen, but that doesn’t change anything.

Am I missing something ? Or is there a better way to draw a GUI overlay on the top of my unit like RTS game ?

An answer to this would be very appreciated.