I would like someone to suggest any tip on how to put an energy bar on every entity of my game like in RTS games. I need it to be fast. I have thought about just having a little cuad allways facing the camera and scale it as it grows / shrinks horizontally, what do you think?. I suppose mesh batcher will take all cuads and render them in one draw call (all share same mat), if not, is there anyway to force it?.
I’ve been recently testing something very similar, for me it seems to work the following way (which is basically the same thing you were suggesting ):
I 've created a 3d mesh (according to your needs it can be a plane or a real 3d mesh) textured it with a “status bar frame GUI” , just in back of this plane you can create all the “status bar’s” you want (being simple rectangular planes of the size of the “status bar”) , set the pivot point of the bar meshes to where you want your “bar” to begin. (you can also use bones and a single mesh, according to your needs)
Then in Unity simply calculate the “bar” localScale based on the values you want to show (example, full health, bar.localScale.x = 1, 0 Health bar.localScale.x = 0 ).
Put all this inside a “GameObject” which acts as root of the group of meshes,and use it with whichever object you want. With some easy coding you can turn all in a Prefab which you can use with many kind of different units.
Hum… not sure I managed to explain what I wanted to (English isn’t my mother language… ), but hopefully it can help
In the screengrab I attached there is a basic setup of what I was trying to explain.
The grey plane should be textured with what is going to be the “frame” for your status bars.
The colored planes are the status bars. You can either make the frame and status bars different meshes or use bones and assign different weight to the frame and the status bars, anyhow if you use same material unity will batch them.
In unity then I would “scale” the bar mesh (or bone) according to the values i care for.
Using transparency on the main “frame” plane you can achieve many kind of different status bars (placing the bars in back of the main “frame”).
Using planes do requires that you check that they alway face correctly the camera if using them on different objects and positions / rotations.
If your are willing to sacrifice a draw call, you can even make the status bar color change according to certain parameters (red when low health and green when it is high).
More or less is what I thinking of, but without using any frame (WHy would I need it?). I will have then a little plane that I will scale accordling to my entity vitality, etc… The bones option for the character is a good option, and yes, I need to make them a billboard :).