Variable To Widget Hud?

Hi, I was thinking i wanted todo something a little more advanced.
I want My thirst system to show up as a value in my widget
Replacing the 0 Screenshot - 2ebc611deaa6a36bb7b4cc9478da4f11 - Gyazo

But i have no idea how to get my variable from level blueprint into the Widget HUD, tried to look around but didnt find anything to help me 100%.

Here is a screenshot from my level blueprint (Thirst system): Screenshot - 05a9447e1d78c392230ce435076d4ae8 - Gyazo

I know you can use “Cast to” but im not 100% how that works, i only used UE4 for a Week now.

You probably want to have your thirst variable in your player controller, player state or game state, depending on what you have already set up.

The level blueprint is a bit of a black box to the other blueprints, it would have to push the variable reference at the start up of the widget etc. it’s messy.

To link the thirst variable from your class (e.g. player controller) onto the widget, there is a neat Binding technique, as follow.

In the UMG you create the widget to represent thirst and then you Bind it to the, e.g., Player controller’s variable.

Here is an example.

Hope this helps :slight_smile: