How do i reference my actor blueprint float variable in a widget blueprint?

The character:

  • it has a collision sphere that deals random damage to whatever it touches

The Enemy:

  • it has a Widget Component set to Screen Mode
  • we get a reference to the embedded widget at Begin Play so we don’t need to cast all the time
  • when this enemy actor receives Any Damage, we calculate a new health value
  • we then use the reference to update the widget

The widget:

  • Construct fills the progress bar and sets the text to a default state
  • when the widget is updated by the enemy who owns it, we store the new health value to display
  • Tick interpolates from current percent to Target every frame and updates the Progress Bar and the Text Block
  • the health value is Map Ranged as the Progress Bar accepts 0-1 rather than 0-100

Image from Gyazo