uGUI Text draw calls
Hi,
I've got the following UI :
I'm optimizing draw calls.
And as you can see, 15 draw calls. High for what i'm displaying. ( Already Spritepacked, only one font. )
I investigated, and i think the uGUI text are causing me troubles.
Here is the same view without the text :
From 15 to 3 draw calls.
In the cell widget ( prefab ), deleting the text GO and making a brand new one fixed the issue.
In every other label, even if i make a brand new one, the frame debugger stops on it and ALWAYS use one draw call to draw ONE label.
Looks like the text rendering is done exaclty in the hierarchy's order, without any optimization.
I can't find what's the problem about my texts.
Any idea?
Alex.
Answer by hexagonius · Feb 08, 2016 at 09:06 PM
From my understanding, you need to consider 3 facts here
The UI is rendered in hierarchical order
dynamic text is written to a texture with appropriate size
for batching to work, material and texture atlas hehe to be the same
so what I think you'd need to do is ordering your visuals. batches sprites first, texts last
It does work if i place all my texts at the end of the hierarchy. But i'm using layouts and this is not something i can do, is it?
eg : With a vertical layout with title at top, you can't put your texts at the end of the hierarchy, can you?
edit: by the way, with the default "UI\Button" which contains a image and a text, this issue doesn't occurs. ( Label that aren't at the end of the hierarchy still are rendered all at the same time if they aren't overlapping. )
Your answer
Follow this Question
Related Questions
Draw calls and text on UGUI 0 Answers
Best optimization for multiple UI Canvas from prefabs 0 Answers
GUI/Text Asset for Unity? 0 Answers
Simple Game Over script 2 Answers
Set default text color when extending Text component 1 Answer