Reducing draw Calls

Hello,

currently im workin on reducing draw calls in my uGUI.

But since uGUI renders the objects accordingly to their hierarchy, this process is pretty weird.

So i put each Text in a seperate Canvas and checked override sorting.

But now each single Canvas generates a new Draw call :frowning:

So how can i fix the drawcall order (first the images, then the text, usually this are 2 draw calls), without destroying the hierarchy ?

Best regards :slight_smile:

So i’d first ask, are you sure you need to be reducing them? from what i can see you have 10 in that scene which really is nothing to worry about. As for changing the way it sorts them no there is no way other then making sure things dont overlap one another in ways that would break batches.

Thank you for your fast answer !

I started this process with 32 drawcalls (±2), now im down to 10 and saw this weird process, since i was used to the draworder from sprites :confused:

i just wanted to make sure i dont make some stupid mistakes,

hmm ok if there is no solution to my current scene, since the text has to overlap the images.

Thank you again )

Yea the text overlapping the images is fine, its situations where its texture → text → texture overlapping that causes breaks in drawcalls.

guessing here but for example “Account name” has a bounding box which overlaps the white background (obviously) and likely the grey “home” texture (possibly the red square). Due to the hierarchy order its likely that the system is being told that the text needs to be between the white back ground and the grey (or red) box which causes the white background and grey (or red) box not to be able to batch together.

Is there a reason UI Elements dont support sorting layers like Sprites ?

With sprites i could “tell” unity how he needs to draw them and in which order.

Finding a nice way to take that into account while at the same time doing our auto batching is not the simplest thing so we just havn’t solve that issue yet.

Ok thank you for your answers !

Have a nice day phil :slight_smile: