Has anybody made a graphical life bar with UnityGUI yet? I am attempting to make one, by putting a GUI Box with the bar housing, and then a GUI Label with the bar inside image (which completely fills up the empty part of the box), and then scaling the size of the label, hoping that the end part of the image would get cut off. No such luck however. Any ideas?
Have you tried the method listed in the middle of this page yet?
I haven’t. I’ll have to give that a shot.
This is what I am using currently:
GUI.Box (Rect (70, 10, Mathf.Clamp01(hitPointsCurrent / hitPointsMax) * (Screen.width - 140), 20), "", GUIstyle);
I am doing basically the same for an in-game progress bar. Works very well. You just set your progress bar’s BG image in a new GUIStyle for it.
healthBarStyle.normal.background = healthBarTexture;
-Jeremy
I used the example shown on the UnityGUI page, and with some tweaking to my likings, I was able to get it just the way I want it.
Thanks for showing me that Jessy.