Problems with preferred width

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:
3465278--274991--TMProBugBox1.png

Box 2:
3465278--274992--TMProBugBox2.png

I’ll try taking a look this afternoon and provide feedback thereafter.

1 Like

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.

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

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

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.

Sounds good I will keep an eye out :slight_smile: