Esteban Ibarra

Nov 2, 2021

1 min read

Organizing your UI for performance in Unity

My currently unoptimized galaxy shooter UI.

In a nutshell, Unity recommends you separate your canvases based on whether you will update them or not. The canvas that you don’t update will have purely static elements and be called the static canvas. The canvas you do update will be the active one. The reason it’s done this way is when you modify an element inside a canvas, it’s considered ‘dirtying up the canvas’ and so every element inside of the canvas must be redrawn.

Unity also raycasts every image on the canvas. It’s important that if an image isn’t clickable, you turn off raycast target.

Don’t turn off the canvas object, instead turn off the canvas component. It’s more efficient.

Hope this helps! You can always check Unitys official optimization tips page for more updated information!