Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TextMesh Pro Problems with preferred width

Discussion in 'UGUI & TextMesh Pro' started by TheValar, Apr 17, 2018.

  1. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    Ran into a bug today with Text Mesh Pro UGUI's preferred width calculation.

    When my text contains very long lines of text with no spaces it seems to mess up the calculation.

    In my test I have two text boxes with a content size fitter
    Horizontal Fit: unconstrained
    Vertical Fit: Preferred Size

    Box 1 Text:
    this is a very very very very very very very long sentance that does have spaces
    this is a very very very very very very very long sentance that does have spaces
    this is a very very very very very very very long sentance that does have spaces

    Box 2 Text:
    thisisaveryveryveryveryveryverylongsentancethatdoesnothavespaces
    thisisaveryveryveryveryveryverylongsentancethatdoesnothavespaces
    thisisaveryveryveryveryveryverylongsentancethatdoesnothavespaces

    Box 1's preferred height is calculated properly unless the width is absurdly thin but Box 2's preferred height is totally wrong for a wide range of widths.

    Box 1:
    TMProBugBox1.png

    Box 2:
    TMProBugBox2.png
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I'll try taking a look this afternoon and provide feedback thereafter.
     
    TheValar likes this.
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I finally had a chance to test this and it is working fine on my end. Please note that I am using the latest release of TMP for Unity 2018.1 which is version 1.2.2.

    What version of Unity and TextMesh Pro are you using?

    If you don't mind and just for testing, see if you get the same behavior with this release for Unity 2018.1.
     
  4. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    I'm on Unity version 2017.3.1p4
    I will give 2018.1 a try today and see if I get different behaviour

    Version of TMPro is whatever is available in the Asset Store which appears to be 1.0.56.0b3
     
    Last edited: Apr 18, 2018
  5. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    Ok Tested on 2018 beta with version 1.2.2 and it does not occur so the problem only exists in the current asset store version
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I guess I better release that new version then. I should be able to upload the new version to the Asset Store this weekend and post direct links to it as well.
     
  7. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    Sounds good I will keep an eye out :)