Hello, to give you some context for the type of problem this is trying to solve, I have X buttons (a lot of buttons) being spawned in my widget, and each of them display the health of a monster in the game. I’ve implemented a delegate (in c++) that broadcasts whenever a monster’s health gets changed, and would like to connect this delegate firing to a Blueprint event in the individual health widgets that updates their UI.
So, assume
HealthChangedDelegate
is a multicast dynamic delegate attached to the monster actor, accessible through the gamestate/gamemode/whatever. It’s signature is a single float, representing health.
WBP_MainHUD
is a HUD blueprint attached to the character. It also creates the health bar widgets for each monster at OnBeginPlay
WBP_MonsterStatsUI
is a Widget blueprint that just displays a single monster’s name and health. It has an event UpdateHealthUI
that takes in a float representing health and updates the health bar.
This seems simple enough. My WBP_MainHUD
for each stats widget at OnBeginPlay assigns it the monster’s name, and uses the node Bind Health Changed Delegate to Event
to bind the HealthChangedDelegate
to that specific WBP_MonsterStatsUI
’s UpdateHealthUI
event. Except… it seems like I can’t get a reference to UpdateHealthUI
outside of it’s owning widget. I can only call it.
Is this a structural limit of blueprints? In code this would be a pretty clean and easy pattern to implement. As a quick fix I now just bind the delegate inside the WBP_StatsUI
itself, but that couples it to the monster and GameState logic. Not the end of the world, but undesirable.
Any points in the right direction are appreciated