User widget casting fails (floating health bar)

I made a floating health bar widget and I’m trying to add it to my enemy parent class, so that all enemies will have one. I need the cast to be able to update the health bar when an enemy takes damage.

BP_FloatingHealthBar has ‘User Widget’ as its parent class.

FloatingHealthBar is a widget component using the widget class BP_FloatingHealthBar. It has ‘Editable when inherited’ ticked.

‘Get User Widget Object’ node returns a User Widget Object Reference value, and somehow casting that to a BP_FloatingHealthBar Object Reference is failing. I have no idea why.

So unchecking ‘Editable when inherited’ on BP_FloatingHealthBar and ‘Instance editable’, ‘Expose on spawn’ on the reference variable fixes it.