I am trying to create a health bar. My health bar starts out gray instead of green as it should to indicate the health of the character—that the character has not died. My variables are both set to 100.0. How do I correct this issue? This is a link to a YouTube video that I used: Unreal Engine 4 - Basic Health Bar - YouTube
Is that a binding or a function? Is there any place where you change max and current health? Did you default your progress bar to be filled from the start (if you did in the widget it should be filled green)?
This is a binding. No I did not change max or current health. And how do you default you progress bar to be filled from the start?
In the widget designer if you click on the progress bar and look for the “percent” value in the details panel you can increase or decrease it to values between 0 and 1. If your bar is colored in the widget designer then you are fine. Also, less likely this is your issue if it is a binding as I would imagine the binding would correct the value on the first frame regardless. But you can check and see.
Ok I change the percent value from 0 to 1 but it still is gray when a click play.
Sounds like either a bad reference or you are changing the value of current health somewhere and it isn’t 100. Check the cast node on the binding see if it is failing or not. Print a string from the cast node “fail” pin and see if it prints or it succeeds.
The string print when the player dies.
So your cast works. Try hard coding a value in for the return value of the binding. Like just break the float going to it from health/max health and type in 0.5 into the binding see if it changes the progress bar. If that doesn’t work there is something wrong with your binding, or you have a binding to the wrong progress bar or something like that.
Tried hard coding it no change.
Fix it. Thank you very much.
Your binding is broken then. Try deleting it and recreating. See if you can hard code something in
Glad we fixed it. Stupid blueprints haha