Creating 2d Health Bars

SO i wanted to create a health bar for my player character and enemy.

I found some answers… but wasnt happy with them. Most included 3D view.

Is there a possiblity to draw an rectangle over enemy which is 200 pixels width and with each attack the rectangle tranforms to 75 %, 50 %, 25 % of the length?

Is there any other method to draw rectangle than to use GUI function?

Sure, there are lots of ways.

I did this for a fighting game using two GUITextures. The first is the box for the rectangle. The second is the rectangle itself.

To make it shrink towards the right side, i just changed the second GUtexture’s size in X. To make it scale to the right, i changed its size and moved it over.

You could use the line renderer to draw a line with a specific thickness