it seems your ‘Target’ variable below has a blue note…maybe because you are tying to cast some variable that is the class of the cast already. also It seems Target variable is empty at the moment of the cast to store inside ‘As BP Lion’
I dont know where you assign a value to ‘Target’ value and how. But if you do, sometimes the asignment is being executed after for query the variable somewhere.
A little delay before the cast and set would work in that case.
Let me try to show you one approach to ‘automatically’ adjust the bar color with the bar percent value on next reply
in the pre construct create a dynamic material instance of the material and set to the bar. Then just add a UPDATE BAR function to update the color and wipe with the Percent Variable.Tag the percent variable as public so it can be accessed from a parent widget as direct parameter. Also add a color curve variable with the initial curve color asset.
Now you can control progress and color just by calling UpdateBar function.
Now create another test widget and drop this one as child widget. Note on the right panel you will have access to the percent variable…if you change it, the wipe and color changes:
is the variable of type BP_Lion? In that case the cast is redundant and will not work. Notice the blue “NOTE” information below the cast. It’s usually that it is not needed, so it might fail by default.
If target is a BP_Lion variable then just pass in target to the set “As BP Lion” node.
However I don’t understand how to make it work dynamically in game. It keeps that manually put value and doesn’t change
So in the Main Widget Graph I made a cast to my character BP (the cast is successful) to get his health (it works fine on the classic unreal progress bar but I can’t make it work on custom stuff