What is the less expensive way for RTS "over units" life bar ?

Hi,

I can’t find an inexpensive way to make rts lfe bar over units for my moba game.

For now i am using a simple rectangulary 3D model that face the camera, i found it less expensive than using unity Ui or GUItexture, but i can’t make any fancy effect with it.

On the unity Ui, the main problem was having a canvas for each unit, wich became very expensive after a certain amount of units.

So, do you guys have a solution ? A workaround ?

thx.

Nobody on that ? how do you guys do ? One canvas per unit ?

You can make on screen space Caravans and put all the live bars in that canvas, than you just need to figure out the position on screen and the distance to the game camera so you can scale the bar accordingly.

You could use functions like this to do this
Get the point of the unit on screen.

Convert a given point in screen space into a pixel correct point.

get the distance from your unity to the game camera.

I did use it to put a small flag over a specific point on screen.

Dow-side you may get some funny sorting problems if you have a lot of unity near eachother and the live bars are overlapping.

do you have a screenshot of it ?
what do you mean by “caravans” ?

blame spell check, looks like he meant “Canvas”

you want a screen shot of the health bars appearing over units?

@LeftyRighty
In fact i would like to compare with my way.

BTW I can’t imagine having a lot of canvas and not having performance drops, could someone confirm that ?