Example 2. Property Binding
Instead of using Function Binding, we could use Property Binding which is a little more cost effective.
Taking our same Health/Energy setup.
On the Graph tab of our Widget Blueprint we use the Event Construct to get a reference to the Player Character Blueprint.
In the first example, we were Casting in Blueprints to our Character Blueprint every frame to access the variables for Health and Energy. Here we are doing that once and storing it as a reference so that we don't have to do it every frame. This is a little more cost effective than the previous method.
We could then bind the values for our progress bars directly to the variables inside our Character Blueprint.
With this method, we are no longer casting every frame and checking "what is the player character blueprint" and once I have it "give me the values for health and energy". We know what the player character is, however we are still looking at it and every frame asking "what is the character's health and energy".
Similar to the previous method, based on the scope of your project, this is generally safe to do. But as you expand optimizations are needed, if you have several properties that are set up this way you can begin to see how this could affect your performance.