Search Unity

TextMesh Pro Performance regarding TMPUGUI in a simple scene

Discussion in 'UGUI & TextMesh Pro' started by GastonC, Apr 18, 2018.

  1. GastonC

    GastonC

    Joined:
    Aug 26, 2012
    Posts:
    38
    Hello!

    I'm trying to improve the performance of our UI. The game runs fine in mobile, but everytime we instantiate a new panel, we see some jumps in the FPS meter. I isolated one simple panel (the shop), in an empty scene, have it disabled, and profile what happens when I enable it.

    What I saw, is that TextMeshProUGUI.Rebuild() was taking up most of the frame time (34ms), which is insane. If I test the same thing with a simple UI Text component, I get <2ms.

    I searched a lot in the forums & web, and couldn't find anything regarding this, which makes me think I'm the one doing something wrong lol.

    Any help?

    [I attached some screenshots] Screen Shot 2018-04-18 at 12.44.49.png Screen Shot 2018-04-18 at 12.44.28.png Screen Shot 2018-04-18 at 12.40.14.png Screen Shot 2018-04-18 at 12.40.05.png
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    That performance hit seems high. Any chance you can submit a bug report with that scene so I can take a closer look?
     
  3. GastonC

    GastonC

    Joined:
    Aug 26, 2012
    Posts:
    38
    Stephan_B likes this.
  4. GastonC

    GastonC

    Joined:
    Aug 26, 2012
    Posts:
    38
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I need to get to this. Thank you for the reminder.
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I finally had a chance to take a look at the project you provided.

    Before diving into things, thank you for providing the Repro project as this always makes it much easier to identify potential issues and to provide more accurate insight on what's going on.

    I would like to confirm that I am seeing roughly the same performance results that you are reporting.

    It is important to remember that we are looking at deep profiling results which due to the profiling overhead always reflect much slower / inflated times compared to what they would be in a production build. On the other hand, deep profiling data is extremely valuable in terms of understanding the performance of various things / functions relative to each others.

    In the case of the scene you provided, as we enter play mode since everything is disabled, none of the resources used by TextMesh Pro have been loaded. So on the first enabling, the settings, font asset, managers, shaders, etc. all have to be loaded / initialized which all happens on the first generation of that text object, which result in that 34ms. Now, if you were to disable / re-enable that same group of objects, the 2nd time around that 34ms for the TMP rebuild would be 0.35ms in deep profile.

    Basically, the bulk of that 34ms comes from those system / resources being loaded. If the scene contained a single text object, then upon entering play mode these resources would be loaded and then upon enabling this group of object for the first time, you would get about 0.35ms.

    Here is an image showing the rebuild time once these resources have been already loaded.
    upload_2018-4-26_23-51-31.png
     
    trenthm likes this.