Optimizing UI - Understanding DrawCalls and Canvas

Our UI has a horrible performance even if nothing is happening so I read myself a little bit into UI optimizing and realised that there is a lot to do and learn. I started reading about DrawCalls and Canvas and stumbled about some very basic concept I don’t seem to fully understand.

So I created a new project with a very basic setup: Just a main camera, a canvas, four images and four texts (TMP) as you can see in this image:

7637008--951160--Screenshot_2.png

Canvas is the UI’s basement. Once only one element changes all children of the canvas need to be redrawn - so far, so good. Since TMP and Image don’t share the same material they can’t be merged into one draw call but need there own instead. This makes 8 draw calls in total.
Now my thought is that whenever one element changes the canvas has to be redrawn using 8 drawcalls. Therefore if nothing changes, nothing has to be redrawn. And that’s where I’m stuck at!

There is nothing but those text and images in the scene so there is no change going on once the first frame has been drawn. But when I check the UI details of the profiler there are 8 drawcalls listed for every frame. How is this possible? I though a canvas is drawn once and saved for futher use in the next frame as long as it’s not set dirty. So why is it apperently redrawn every frame even nothing is changing? What’s my missunderstanding here?

Thanks for any help! :slight_smile:

This is not true. I think you’re mixing up redrawing and regenerating. This is still graphics, you need to redraw everything, every frame. When you change something in UI, the mesh needs to be regenerated. That’s another ballpark.
I recommend watching this presentation about the performance implications of Unity UI (the other stuff is useful too, but the UI part is especially):

https://www.youtube.com/watch?v=_wxitgdx-UI