Hello!
I’ve discovered that animated Images using Sprite Mesh triggers gcallocs every update, and thought that I’d share my findings.
Below is a profiler screenshot from an old Android device, but this happens in Editor too. To the left is a scene that has animated UI, and to the right is a new build with the same scene, same animation, but with Use Sprite Mesh turned On on most Images in the UI.
This happens because the animation causes the canvas to rebuild, since things have moved around. The issue could be mitigated of course by making sure things that don’t move are in a different canvas than the ones that do move, though this can be a tricky puzzle when it comes to sorting if you have a lot of layered Images. I’m guessing there is no way around this, so I’m gonna just turn off Sprite Mesh on animated Images, and just take the overdraw hit. I believe that is preferable to having gcallocs.
If you have thoughts or experiences with this, please do share. ![]()
Unity Editor 2022.3.26
URP 14.0.11
