Search Unity

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

Discussion in 'UGUI & TextMesh Pro' started by Deleted User, Sep 18, 2015.

  1. Deleted User

    Deleted User

    Guest

    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?
     
  2. wikmanyo

    wikmanyo

    Joined:
    Nov 17, 2012
    Posts:
    65
  3. wikmanyo

    wikmanyo

    Joined:
    Nov 17, 2012
    Posts:
    65
    I can confirm the allocations are fixed in Unity 5.2.1p1, however, the CPU overhead for using Shadows / Outlines is now Criminal.
     
  4. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    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:

    Raw ScreenShot.JPG

    upload_2015-9-28_0-55-34.png
    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.
     
    Last edited: Sep 28, 2015
    wikmanyo likes this.