I'm developing a Holographic app for Hololens using Unity 5, I need to create some UI, so Which approximation would provide a better performance?
A single canvas with multiple panels or multiple canvases?
I need multiple UI elements (Text labels, buttons, etc...) with different locations specially with different Z axis values.
So having one giant Canvas for your whole UI is not recommended by Unity. Just separate out different parts of your UI into different Canvases where they make sense and however they're easier to work with.
A single Canvas for all UI elements is sufficient but multiple Canvases in the scene is possible. It is also possible use nested Canvases, where one Canvas is placed as a child of another for optimization purposes. A nested Canvas uses the same Render Mode as its parent.
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). 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 inventories and the like. Of course don't go on the other end with one canvas per element, just be wise with the different UI parts and dynamic UI elements. The ordinary gameObject hierarchies have the same problem but there the performance hit for recalculating the whole hierarchy is much smaller compared to UI.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With