I am new to unity 3d and presently I am working on one island monkey project in which I decided to increment the score while drag and drop the item to land from menu and that time my score is increase and at the same time I decide to increase the progress bar base on level. I don’t no how to load progress bar.
Now if you want to have a custom bar with the shape and color you want, you need first to create them using Gimp or photoshop. You will have to draw a bar for each level of health. Then using a switch statement, depending on your health you draw a particular texture2D.
var health0 : Texture2D;
var health1 : Texture2D;
var health2 : Texture2D;
var HEALTH = 2;
function Update () {
switch(HEALTH){
case 2:
guiTexture.texture = health2;
break;
case 1:
guiTexture.texture = health1;
break;
case 0:
guiTexture.texture = health0;
break;
}
}
In this example I have 3 level of bar, full (2), half(1) or empty(0). You drag the 3 different textures in the inspector in the corresponding slot.
Now another script would alter my health and the value would decrease triggering a different case of the switch and showing a different texture on screen.