- Home /
Health Bars in 2D Game
Hi all. I want make health bars for enemies, which looks like on this screeshot
Main problem is an optimization, I focused on Android and iOS platforms. I tried use OnGUI boxes and changing scale in plane, but it creates many draw calls. Who can give some information or advices about creation of healthbars the same as on the screenshot without FPS reducing?
Thnx
Depending on how many health bars you will have on screen at one time drawing the boxes in OnGUI() will work fine for most mobile devices especially the newer ones.
But that being said OnGUI() is ridiculously performance heavy according to the Unity Profiler.
It is pretty much the highest performance cost on my Android/iOS project which is very surprising and disappointing considering what else is going on in the scenes.
Answer by ZenithCode · Sep 03, 2013 at 08:20 PM
I would suggest you look at ngui. Its a plugin for Unity which will health bars and anything UI related a piece of cake.
Your answer
![](https://koobas.hobune.stream/wayback/20220613113522im_/https://answers.unity.com/themes/thub/images/avi.jpg)