Healthbar without using Unity GUI Functions

How can I make HealthBar without using Unity built in GUI function? How can I make the texture to show only the percentage of it's actual width? Can I get that by using pixel inset... or which ways....


You could add a GUITexture gameobject and use scripts to adjust the Pixel Inset rectangle width or height. I don't generally use GUITexture components often so I don't know if there's a good way to change the scalemode like you can with GUI.DrawTexture script calls.

If you take a plane that is rotated toward the camera scale it under 1 in an axis, it will appear to shrink in that axis until you reach 0, where it will seem to disappear. Apply any texture you want and hooray.

You can make it easier if you create a second camera away from the stuff in your level that is pointed at your HUD and set to only display objects in a specific layer. Then you can put your HUD objects in that layer and not have to worry about keeping your GUI elements billboarded and in the right place when your main camera moves.