Search Unity

"Best Fit" Text performance very poor

Discussion in 'UGUI & TextMesh Pro' started by Capn_Andy, Oct 5, 2014.

  1. Capn_Andy

    Capn_Andy

    Joined:
    Nov 20, 2013
    Posts:
    80
    Heya,

    I have a dynamically displayed menu that can take up the entire screen with a single word, or be a bunch of menus more akin to a standard game. For maximum flexibility and legibility, I've set all my text boxes to "Best Fit" with a minimum of 0, and a maximum of 300. This results in some really bad performance hiccups, especially when the text dynamically changes during runtime.

    As an example, a textfield covering the whole screen might want to be a "patch notes" box, which is particularly terrible. Performance is much better if it's just the word "VICTORY!", so I assume the number of characters multiplied by the max font size starts making things more complicated.

    Reducing the maximum to something lower (like 50) results in better performance, but the text in those instances don't fill the entire screen (despite the anchors being set to cover everything) -- and I suspect if the text was bigger, it would start looking jaggy.

    Am I overlooking something obvious to work around this?
     
  2. JAKJ

    JAKJ

    Joined:
    Aug 17, 2014
    Posts:
    185
    They have admitted the "best fit" thing is the dirtiest of hacks, and it isn't going to get any better until they overhaul the entire text system some time after 4.6/5 comes out. You're recommended to just not use best fit at all for dynamic content that changes with any frequency.
     
    Giovannino82 and Capn_Andy like this.
  3. Giovannino82

    Giovannino82

    Joined:
    Aug 11, 2014
    Posts:
    3
    I solved it (at least it seems solved) this way: select the canvas object and go to the Canvas Scaler (Script); there increase the Scale Factor. I used it just for the canvas with big (well huge) texts. And I used another canvas for buttons and other stuff. Hope it helps. If not please tell me how you worked around this.
     
    sandolkakos and jprocha101 like this.