Drive UI Updates with Events for parent BP actor and child

Hi all,
i have main Bp actor for enemy and i made 6 child out of it.
each one of them has “enemy attribute” which is a widget show the health bar as percentage and health value as text.

i used bind function on enemy attribute widget to decrease the current health and percentage for health bar ,
its works OK but when i have launched the game on mobile i noticed it makes too much draw call and hit the performance on mobile.

what i know about binding function on widget system ,its like an event tick so it will be calculate every frame.

so i tried to used event driven using dispatcher method . from this links…dUI/index.html

i did it for player character and it works great, however when i cast it to parent Bp (enemy actor)nothing happen because it has a child.

i can make it for every child an event dispatcher so i can call it then bind it in widget ,but what if i have 50 child or more.
how can i use event dispatcher “Drive UI Updates with Events” for parent Bp that has many child in enemy attribute “widget” (health bar and health number)?
appreciate your support
thank u all

If all child actors have the same type of enemy attribute, why not define “enemy attribute” in the parent. Then you can have the event dispatcher in your parent.

Also, if you’re using the widget for only displaying health information, you can have your player and enemy blueprints directly send the information to the widget every time the health is updated. This way, it’s still event driven, but you won’t even need an event dispatcher to keep listening in on these actors.

thank you so much for replay, but i define already enemy attribute in the parent actor BP…and cast not working.
regarding “enemy blueprints directly send the information to the widget every time” using function that bind health info i did that already as well but it hits the performance for mobile.
it like event tick , thats why i need to use event dispatcher so its update the health once its change and not every frame.

I wasn’t referring to bind events with regards to sending information to the widget. Instead of binding it, you can manually tell the HUD to update itself with new info as shown below:

Every time my enemy character’s health gets updated, it will pass that information over to its 3D health bar widget. So the widget doesn’t have to know who owns it. All it cares about is what to do if someone (either player or enemy class) sends it health information.

thank you so much … it works smooth now on mobile…:slight_smile: