Unity Community |

When making health bars, is there a specific reason that people don't just use cubes with textures set at a certain distance from the main camera?
Are the cubes more taxing then a GUI or do other people just find it easier to work with GUI? Because I've just found it easier to work with cubes on screen is all.
Discuss!
If you want this kind of health bar :
then yes, a cube or a plane is ok.
But as soon as you try to achieve non rectangular bars, such as this example, or even just non-rectangular bar (which is kind of a standard nowadays), you have to go with a sprite + mask![]()
Kinetic Damage, a 4 years long fighting game project : Official Trailer,
[iTunes Link], [Free Lite Version]
Official Site : www.kineticdamage.com, Facebook page (blog, articles, dev updates).
Dev Blog : Giant thread (+ additional tips & techniques)
I use a set of planes for my UI stuff. I don't use Unity's GUI system.
You may as well texture a plane, it will have marginally better performance than a cube![]()
@n0mad
Yeah, that's pretty much what I figured, but after looking at the example you showed me, it seems like you'd be better off going with the alpha mask, even if it is a bit more effort, due to presentation. Hmmm, perhaps I shall have to look into it
EDIT:
@Meltdown
How did you achieve the gas and nos bars in your monster truck game using planes, if you don't mind me asking
I have a second camera in my scene that is orthographic. Pointing at all my UI elements.
I then used his most esteemed Sir Michael Garforth's CreatePlane script from the wiki to create a bottom anchored plane. Thus when you scale it, it scales from the bottom, not the middle, so the bar resizes.. well like a progress bar.
For the planes I obviously don't use Unity's default plane, you can use the same script to create a 1x1 (two triangle plane mesh) for better performance.
Then just scale the plane height based on your value and a percentage of the plane at it's max height.
This setup works on all resolutions.. but if the screen aspect ratio changes, you'll need to do some manual adjustment of the plane positions. But other than that it will work on all resolutions and aspects/screen resizing you throw at it, which is another reason I preferred it to UnityGUI.
Last edited by Meltdown; 03-03-2012 at 11:56 AM.
Ah, that does make sense! thank's for the info. For some reason changing the anchor point never occurred to me haha
Yeah I just use textured planes. Don't care much for Unity's GUI system.
Completely new to game development and Unity? don't know where to start? You don't have to be a n00b, click here and you'll be a pro in no time! The complete scripting series will bring you from zero to hero!
Really guys, get over it. Everyone these days wants a MMO not single player. I know we should start out small but times have changed. Anymore in the game industry no matter how small or large you have to go big or go home!
Believe it or not I spent a couple of hours trying to manually move and resize a regular plane to make it look bottom anchored lol then eventually started bashing my head against the keyboard. then remembered the anchor function in that script and said.... "No.. it couldn't be.." lol![]()