- Home /
reduce the GUITexture drawcalls
How can I reduce the drawcalls for GUITextures. Currently, it is using 1 drawcall per GUITexture nomatter what their positions are outside the screen or not... I've found GUIManager which is based on the Sprite Manager but GUIManager is not working correctly on Unity3. How will you make the drawcalls of the GUITextures... Does the another way exist either than using GUIManager or Sprite Manager?
Answer by Dreamora 1 · Oct 05, 2010 at 10:10 AM
You can not reduce it. As long as you use GUITexture, GUITexture or anything that is used in OnGUI it will be 1 drawcall per object.
You will need to use a mesh based system like Sprite Manager 2 (SM1 was for Unity iPhone 1.5 prior batching actually and does the batching itself, using it with iphone 1.6+ or U3 is an overkill as it dublicates the logic) or just a simple quad created in a modeller that you use.
also keep in mind that batching once you did above would only work if they use the same material, you can't change any value on it or it will lead to a clone material and cease to work batched.
What do you mean by "a simple quad created in a modeller that you use"? I can't afford the Sprite manager 2 right now, so I assume the "simple quad" is the way forward. Thanks!
Simple quad would mean that you really create a quad in a modeller or through code and then use code that orients it towards the camera and alike (to do what you want it to do)
Answer by LitobyteSoftworks_answers · Dec 04, 2011 at 09:57 PM
The quads have the downside tha they need to'be oriented toward the camera each cycle, this May eat out some CPU if many object are needed. Imagine a bunch of 100 RTS game units, each with HP bar on the top, that would mean make 100 quads look at the camera, won't be slow then?
If you display for instance the HP bars on top of every unit, simply draw them (with quads) on a separate ortho camera. You can get their positions via camera.WorldToScreenPoint.