Unite Europe 2017 - Squeezing Unity: Tips for raising performance

Unity · 131K views · 2017 · 50:07

Open on YouTube

Game programming & enginesSoftware performance & optimizationtalkdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering Unity UI performance questions, especially about splitting canvases so one changing element does not mark a whole hierarchy dirty.

Recommended by 5 people across 6 different months, 2017 to 2023.

Why Game Development Stack Exchange recommends it

Game Development Stack Exchange answerers link it when explaining Unity performance details such as UI canvas rebuilds, uncached Camera.main lookups and general optimization.

Recommended by 4 people across 4 different months, 2018 to 2023.

What it is

A Unite Europe 2017 talk by Ian Dundore and Mark from Unity's Enterprise Support team on performance best practices drawn from real customer projects. It explains the architecture of Unity's core systems, including how UI canvases get rebuilt, to help developers push Unity further.

What people said

Recommends Draco18s no longer trusts SE · 2017-10 · Stack Overflow · on “Is it possible to include a Box Collider component into a Raw Image game object to detect collisions?”

I didn't either until I ran into a talk on YouTube from a Unity guy talking about it. Let me see... was either this one [LINK] or this one [this video] . Both are worth watching.

Recommends Ed Marty · 2018-02 · Game Development Stack Exchange · on “Unity: redraw only part of the GUI”

Sorry I don't have time to summarize this video, but this guy has a lot of insight into optimizing Unity UI: [this video]

Recommends Draco18s no longer trusts SE · 2018-03 · Game Development Stack Exchange · on “Unity: Hiding Game Objects vs Creating them”

However, when using a *canvas* it would be better to give each object (or groups of objects) their own Canvas component and *disable that canvas component.* This prevents the canvas objects higher up in the hierarchy tree from being marked dirty and having to perform an expensive resort. I believe it was this talk [LINK] from Unity that covers that topic (if not, it's this one [this video] ).

Recommends Draco18s no longer trusts SE · 2018-05 · Stack Overflow · on “Screen and World space UI in the same scene”

*`As I understand I shouldn't have more than UI canvas in the scene`* This is false. I believe this talk [this video] goes over it.

Recommends Nikaas · 2018-10 · Stack Overflow · on “Single Canvas and multiple panels vs multiple canvas in Unity 3D”

Unity guys specifically gave a performance talk about UI Canvases on some of the past Unite(s). You won't have trouble finding it on Unity's YouTube channel (edit: here it is - Unite Europe 2017 - Squeezing Unity: Tips for raising performance [this video] ). Basically they saw a trend of performance problems in projects with more complex UIs. The problem arises from the fact that when one single UI element is modified it marks its whole canvas hierarchy as dirty. They(Unity) highly encourage to separate different ui parts in their own canvases. Especially elements that are updated per frame (or just too often) should be in their small separate canvases - things like healthbars, scrolling inventor

Recommends Draco18s no longer trusts SE · 2018-10 · Stack Overflow · on “What I Have Learned About Unity ScrollRect / ScrollView Optimization / Performance”

The mark-dirty thing applies to ALL canvas UI elements. You have an image graphic that moves around? Guess what, it causes all of your static text to get recomputed too! I have trouble remembering if it was this video [LINK] or this one [this video] , but they're both good sources on things you can do to improve your Unity project.

Recommends mgear · 2019-03 · Stack Overflow · on “In Unity, is UI system much worse in terms of performance than using 2D sprite?”

Yes, in general, UI is worse. This opinion is based on the Unity optimization videos and articles. where they mention things like: When one or more elements change on a Canvas, the whole Canvas has to be re-analyzed to figure out how to optimally draw its elements.. and other similar performance issues (see article link below) references: [LINK] [this video] (lots of details about why its slow) But of course you should use profiler your app in device to see whats the actual cause for slow down.

Recommends Candid Moon _Max_ · 2019-12 · Game Development Stack Exchange · on “HIGH energy consumption in Empty Scene Unity iOS”

I am constantly updating this answer, I will remove this message when I have stopped. There is no magic bullet that will make it work right out of the box. It's a series of steps required to achieve good results. Even though Unity is game engine, it can be used for many different purposes. It's very convenient to use Unity for mobile development or other PC applications. Maxing out a device’s capabilities can quickly compromise your game’s performance by overtaxing the hardware, which leads to throttling, poor battery life, and inconsistent performance. To decrease energy consumption of the application we need to make it do less, and that includes increasing it's performance as well, as we d

Recommends ow3n · 2020-10 · Stack Overflow · on “Should I include the Canvas parent GameObject in a UI prefab in Unity”

After a lot more research I've come to some conclusions about the answer: As stated in this talk at Unite 2017 [this video] , isolating UI element "islands" by concern AND how often they are updated will keep the UI from affecting performance. The video also states it is fine to use multiple Canvases inside other Canvases to achieve this goal. If you add a prefab whose values are updated from outside the prefab they will appear as "overrides" to that prefab. This includes if you link to elements outside the prefab from within it and vice versa (see image). Importantly, it is not possible to apply these overrides to the prefab, and that's kind of the point. Unity accepts that these changes will ha

Recommends Marc-Antoine Girard · 2023-03 · Stack Overflow · on “Android game freezing when turning on parent with a large number of childs”

This is a pretty commun issue with how Unity UI works [this video] . (you can check at 29:30 [this video] where he talks about scroll view). Short answer is yes, Unity renders UI even if it's outside of the camera. You can follow the video's guideline to help with UI performance in general. My advice is to pool your items and only show what you need to. Even better would be to not use Unity's Scroll view, which is a mess in term of performance. I haven't used this package [LINK] , but you could check it out. It's supposed to be quite performant and recycles objects so you only render what you need. (and it's free) Side note, Unity's UI Toolkit also has a ListView which pools items and rebinds them, bu