- Home /
What`s more expensive GUI Texures or Quads for displaying units health?(RTS)
Hello,
So what should i use? Quads that follow the units and change color? OR GUI texures that aquire the units position by ray shooting?
And what should i use for smooth movement, FixedUpdate?
Thx in advance.
Answer by robertbu · Feb 20, 2014 at 12:25 AM
Whether you should worry about this issue depends on the number of units you have and what platform you are authoring for. GUITextures cost a drawcall each. It is possible to get all of your Quads to batch together into a single drawcall, but to do so is not as simple as just setting the Material.color. To cause your Quads to batch, you must use a Texture Atlas and/or use Vertex colors to change the color of your Quads. Setting the Material.color attribute breaks batching, so a Quad would be no more efficient than a GUITexture.
Most positioning of a GUITexure does not require a Raycast. It can be done by Camera.WorldToViewportPoint(). As for smooth movement, Update() or possibility LateUpdate() is likely the best choice.
You`re right GUI textures are better.
(I just spent 3 hours on quads and they just move miserably)
I used Gui Textures + Camera.WorldToViewportPoint() before, but there`s a slight delay when I move the camera,and I thought that quads may perform better, but I was wrong ...
Are you doing your movement of Quads and/or GUITexture in LateUpdate()? That may solve any lag issue.
@eddyzy definitely don't use FixedUpdate for anything to do with the screen, that can cause jerkiness as the physics step does not necessarily update every frame. Quads can be totally smooth - so something interesting is going on with the order of things that you do.
Well quads are nice,but following the unit is the problem. I can`t seem to find a way to make the quads follow the unit smoothly. A idea on how to do that?(I used update and the movement isn`t that smooth as GUI Texures)