GUIText does not batch? :S

Hi,

I have a lot of GUITexts on my gui, but I’m surprised tehy doesn’t batch. They all use same material, etc…

What’s up with it?

Thanks in advance,
HexDump.

they obviously use alpha and alpha does not batch

At least thats what I understood basing on a posting from ReJ today on a similar question with alpha-ed materials

Could you point me to this thread? I’m skeptical as to why they wouldn’t be. Alpha blended materials need to be sorted but they can surely be batched after that.

I’m working on a game that has a lot of separate meshes that all have the same transparent material. And they all batch to 1 draw call.

Hi again,

Yes, this is what I thought, that they should batch. Everyone is using Sprite Manager and all batches… and they are using textures with transparencies.

It is a bit of a pain that GUIText one of the few ways we have to put text on screen does not batch :(.

Any suggestion? Yes… Create my own Textured fonts function…

Thanks in advance,
HexDump.

Due to historical reasons (which are really hard to change now) GUIText internally is rendered via separate code path which does not support batching as is. Same for OnGUI friends.

Hi,

Thanks for the answer, it clarifies the problem. It’s a pitty this couldn’t be fixed… Time to write own textured font renderer.

Thanks in advance,
HexDump.

TextMeshes do batch, thankfully. If it’s on-screen text that doesn’t need to move much, just attach the TextMesh GameObject to the main camera.

Hi,

Yes you’re right, the problem comes when you wnat to put this text on a GUITexture for example. At the end you will find same problem… If you want your text to batch, do it yourself.

Thanks in advance,
HexDump.

From my experience, it only occurs with AlphaTesting, and does happen 20-30% of the overall batching. Which means it won’t occur with a few alpha objects.

((300 verts x number of shader passes) limit set apart)