Organizing your UI for Performance in Unity

Objective: Static vs Dynamic UI

There are some ways to optimize how the UI performs in Unity the first of which is to use multiple canvases. These should be split at minimum between static and dynamic. This is because Unity redraws the entire canvas when instead of just the canvas element that gets updated.

All non moving elements such as frames, images and text can be seperated from text, images and buttons that change or are interactive. You could go further and spilt interactive elements into more seperated canvas such as player health, gems/coins then have all button elements on another canvas and so on.

Another thing to look at is raycasts and images. Unity uses Raycasts on every image in a canvas therefore the best option is for all non interactive images is to turn the Raycast target off if not needed.

One that might surprise you is enabling and disabling canvas game objects. It is actually much more performant to enable and disable the canvas component of the object rather than the object.

For more on UI optimization and details on how to perform these tips, there is a very nice article in Unitys pages which can be found here.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store