Accessed None trying to read property - From Interface event to Widget

Hi,
I want to update widget values from interface bluebrint.

interface_entry

I want to update Current health and Percent, for selected class

That informations doesnt transfer from blueprint to widget

Blueprint Runtime Error: “Accessed None trying to read property EnemyHealthUI”. Blueprint: BP_EnemyBase Function: Execute Ubergraph BP Enemy Base Graph: EventGraph Node: Update Enemy Health Bar

Can you please help me to fix this?

Not sure how to fix your code i would need to see it all. (and cannot guess rest of setup now)

However i can give you my solution to whole widgets inside widgets also runtime spawned widgets mess. Yes I had plenty of problems like you are just describing. And I stole idea for my solution from windows events/message system.

So how it works:

  • in player character or player controller i create dispatcher that has 2 variables exposed, one is enumerator that contains type of information (like ammo, health stamina or whatever you need to be displayed on HUD), second field is string (because you can convert float to string then float then display it).

  • each widget can find its owning player controller reference easy. when loaded/initiated each widget gets that reference and assigns to event dispatcher.

  • then all is easy if enumerator with type of info matches what widget wants it updates its own (widgets) variable. Then when time to display stuff comes, that widget reads own variables. So this way i need to update foe eg. health only when it changed. No more mindless reading of everything every frame.