I’ve already created a separate canvas that holds a tiny fraction of the UI gameobjects which act as input controls (steering / acceleration) so that, if dirty, the canvas rebuild will affect only them. At any given point there should be less than 10 objects enabled. Here is the hierarchy
In the above scenario I’ve eliminated almost everything from the screen leaving just 5 buttons (acceleration, brake and 3 buttons on top-left corner, none of which change their position, rotation or scale, so they shouldn’t mark the canvas dirty at all) but even so the spikes still occur. Below is the screenshot from the game
I’ve read many threads, tutorials and pages from unity manual but am sort of out of ideas why the spikes are still there when there shouldn’t be any objects that mark the canvas dirty in the first place (none are enabled/disabled or change position/rotation/scale) and even if they were the rebuild should affect a tiny number of UI objects (6-7 max).
Please check if the issue also occurs with the latest 2018.4 LTS release, it’s 2018.4.5 at the time of writing. If the issue persists and can be reproduced, please submit a bug-report as described in this document:
It’s important that you report these issues together with a reproduction project if you want them to get fixed. If you don’t do it, it might be a long time until someone else reports them or until Unity Technologies find them.
After you submitted the bug-report, you receive a confirmation email with a bug-report Case number. Please post the Case number (number only, not the link) in this forum thread for Unity staff to pick up.
Looks like at least someone else has the problem on 2019:
A quick Google reveals this is a problem which many people have had since at least 2015; there are numerous forum posts and “optimization guides”. I doubt unity can fix it; it is probably an underlying limitation of the canvas system and the focus will be on something shiny and new. Personally as i am only using text rendering i will probably try moving to textmeshpro in 3d to avoid canvas altogether perhaps.
Nevertheless if time allows i will submit a bug report and an example project if i can reduce my 40gb project to something uploadable.
English is not my first language. Do you mean that in reality Canvas.BuildBatch doesn’t consume that much resources and this is a profiler error causing it to provide wrong information? Can we get an issue tracker number for this?