i want to give a hp bar to an enemy but there's something wrong with my widget blueprint

  • the reference is probably null
  • there’s no need to cast
  • widgets should not be pulling data like this; note this is executed every frame, non-stop

Instead:

  • remove this function binding from the widget’s Progress Bar
  • in the widget, create a Custom Event with a single float and have it update the progress bar
  • when the Enemy BP creates the widget, store its reference
  • when enemies’ health values change, use the widget reference to call the Custom Event and push in the percentage

Can you show me an image of how the blueprint of that custom event would look like?
Also when you say to call the custom event do you mean mean with an event dipatcher?

1 Like

No, the custom event above.

call it in the same blueprint? how exactly?

call it in the same blueprint? how exactly?

The enemy calls a custom event of its own widget.


Are you using a Widget Component or a regular Widget?

i’m using this

1 Like

A widget component then, cool!

  • in the widget:

  • in the Mushroom BP:

In short: whenever this enemy receives damage, we calculate health and update the widget.

that did it thanks a ton

1 Like