Widgets can be set to automatically grab data from variables in our widget classes. This is done by binding a property to one of our variables. Let's take a look at how that works:
- Open the MyWidget Blueprint
- In the Graph window, create a variable called Pickups and set its variable type to Text
- In the Update Remaining Spheres function, delete the Remaining Spheres GET node and the SET Text function call
- Create a SET node for our new Pickups variable and connect it to the Remaining Pickups Int to Text conversion and the output of the ThirdPersonGameMode cast
The function should now look like the following screenshot:
Now that our variable is updating, we just need to bind the Text widget's property to it:
- In the Designer window, select the Text widget.
- In the Details panel, there is a Bind drop-down box next to Content | Text. You can select the...