[5.2] Massive GC alloc when using Text with Shadow and Outline

We’re seeing a massive drop in performance and huge GC allocs when rendering text with shadow and outline on a world space canvas. The profiler shows the issue under Canvas.SendWillRenderCanvases. Here are the numbers:

Test GC Alloc Time ms
Plain Text 2.6 KB 0.36
Text + Shadow 68.6 KB 1.82
Text + Outline 289.8 KB 4.10
Text + Shadow + Outline 0.6 MB 8.81

That’s right, 0.6 megabyte per frame!

What is this? A bug? A feature we’re using wrong?

its fixed already…

I can confirm the allocations are fixed in Unity 5.2.1p1, however, the CPU overhead for using Shadows / Outlines is now Criminal.

Just ran the first benchmark comparing UI.Text with Oultine & Shadow vs. TextMesh Pro with Outline & Shadow in Unity 5.2.1p1. The results for Canvas.SendWillRenderCanvases() in the Profiler using a Desktop build with “Don’tSync” are as follows:

2314828--156013--Raw ScreenShot.JPG


Top object is UI.Text and bottom is TextMesh Pro.

Please note this test was done with the version of TextMesh Pro that I am currently working on which is now using the Mesh class and CanvasRenderer.SetMesh() instead of the previous UiVertex and CanvasRenderer.SetVertices(). This release should be out within the next 7 days.

1 Like