- Home /
Answer by SilverTabby · Jul 12, 2011 at 10:24 AM
What I would do is use GUI.Box. Then feed the health value into the length and/or width of the rectangle (scale as needed). You can use a custom texture by passing in a GUIContent Object with your health bar texture on it. You can also pass your health as a string to have it displayed on the box.
This is what I'm using for my game's health bar, and I think it is all you need for yours.
Hope this helped
Answer by YikYikHeiHei · Jul 12, 2011 at 11:41 AM
It can make health bar easily...
var yourHealth = 100.0;
var yourMaxHealth = 100.0;
function Start ()
{
yourHealth = yourMaxHealth;
}
function OnGUI ()
{
GUI.HorizontalScrollbar(Rect (0,40,300,20), 0, yourHealth,0, yourMaxHealth);
}
Your answer
Follow this Question
Related Questions
How do I make a custom health bar? 0 Answers
Change Background Music When Health = 0 1 Answer
Transparent Cutout Shader? 1 Answer
Assigning UV Map to model at runtime 0 Answers