How can i update widget without tick event


I have some player stats: HP, MANA, etc.

I want to display it on the screen.

But i need to do it without using event tick.

So, how do I know that a variable has changed and send a signal to the widget?

I can’t try it right now, but I’m pretty sure you can bind to an event dispatcher from a widget.

So the dispatcher would be in another BP, and the bind call would have to be made every time the widget was constructed.

I can confirm that is possible. It’s definitely the best method

When you create the HUD or Widget for stats, create a widget reference of that class in the player character or player controller, where ever you’re storing the variables. When you hold shift key, the stamina will go down, you can then ‘get’ the widget reference and set the widget variable to the player controller’s stamina variable. Just make sure that the widget is using the widget’s stamina as a bind value in the text block.

Basically, whenever an action is carried out to change those values, get the player controller’s widget reference and update those values.

Edit for Specificity:
Don’t make a variable named HudRef of class: widget in the player controller. If the widget BP is called BP_StatsWidget, then make sure the variable in the player controller is that BP class.