r/UnityHelp • • Mar 14 '22

UNITY Need help understanding "Dirty canvases"

Hello everyone!

I'm having trouble understanding the concept of dirty canvases, and I hope you can help.

As I understand it, if I have a canvas with an image and text element under it, and the text changes; the whole canvas needs to be redrawn. This happens because the entire canvas is marked "dirty" and so it has to be redrawn.

So far so good.

Now consider the following example:

I have a parent canvas A.

Inside it, I have child canvas B and child canvas C.

B holds the image, and C holds the text.

If the text changes, it makes sense that C is redrawn. Now, since something changed under A, does that mean that A is redrawn, and therefore B is redrawn as well?

I'm currently facing an issue of this nature at work so any help will be appreciated.

Thanks!

4 Upvotes

1 comment sorted by

1

u/Canamla Mar 15 '22 edited Mar 15 '22

https://youtu.be/_wxitgdx-UI

This talk will tell you that stuff and more. But yes, anything that is in a canvas hierarchy that is dirty will cause the whole canvas to be repainted.

Edit: whoops, I misunderstood your post. Sorry. I don't know for sure, but I believe the guy in that talk says subcanvases will not make parent canvases repaint.