Optimizing user interface driven by Unity UI is an art of development. The hard and fast rules are quite rare; instead, each situation must be carefully evaluated keeping the system’s nature in mind. The core tension while optimizing any Unity UI is the balancing of draw calls with batching costs. While some major common-sense techniques can also be used to decrease one or other, complex UIs must make trade-offs.
There are 4 major common classes of problems that are encountered by users of Unity UI i.e. excessive GPU fragments shaded utilization, Excessive CPU time spent on Canvas batch, excessive numbers of rebuilds of canvas batches, excessive CPU time spent in generating vertices.
Techniques to optimize while designing, building UI:
Improve site speed:
Site speed matters a lot to ensure a positive user experience. Therefore, a typical web user expects a site to get loaded within 2 seconds or less than that, otherwise, the users will leave your site immediately. The most common way that will help you to reduce your website loading time is to optimize your images as they often count for most of the download bytes on web pages. You should eliminate the unimportant images and should
leverage CSS3 effects wherever requires and possible.
React Transform based layout:
Layout components are relatively expensive, as they should recomputed the sizes and the portions of their child elements each time they are marked in dirty proportion. If there are a relatively small and fixed number of elements within a given layout, and the layout has simple structure, then it may be possible to replace the layout with React Transform based layout.
By assigning the anchors of React Transform, the positions and the sizes can be made to scale based on its parent classes. By the transform system itself, the computation of the size and the position of React Transform will be driven ion native code. However, this is relatively complex task and will lie beyond the scope of UI based techniques.
Improve site reliability:
It is very crucial that you should choose a reliable web host which does not bog down with loading times. A good hosting provider and a content delivery network will help in improving the overall reliability of the site. As per the reports of Bill Hoffman, it was stated that the sites with faster backend infrastructure receive a higher rank from Google.
Easy to engage/ navigate:
Navigation is another important factor for user-friendly site. Before a site design is finalized, it is crucial to plan a hierarchy so that all the pages can get accessed easily by both i.e. search engine and the human. Some of the ways by which you can ease out navigation for UI is to use breadcrumbs, contextual links, and sitemaps.
Source code customization:
The UI system has been designed for supporting a large number of use cases. This flexibility is great, but it also means that some of the major optimizations cannot be easily performed without breaking other features. If you end up in situation, where you can increase some CPU cycles by changing the UI source code, then it can be possible to recompile the UI DILL and overwrite the one shipped with Unity.