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 https://gyazo.com/2ebc611deaa6a36bb7b4cc9478da4f11
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): https://gyazo.com/05a9447e1d78c392230ce435076d4ae8
I know you can use "Cast to" but im not 100% how that works, i only used UE4 for a Week now.
asked Apr 14 '16 at 09:19 AM in Blueprint Scripting
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 :)
answered Apr 14 '16 at 09:33 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here