Search Unity

Bug TextMesh Pro AutoSize uses Max size for Preferred Width

Discussion in 'UGUI & TextMesh Pro' started by HaydenFerries, Jul 19, 2022.

  1. HaydenFerries

    HaydenFerries

    Joined:
    Jun 27, 2019
    Posts:
    1
    Hello,

    I am using TextMesh Pro version 3.0.6 in Unity 2020.3.34f1 and there is a line of code within TMP_Text.cs
    GetPreferredWidth() method that overrides the font size with the max auto size font size.

    Line 3744 : float fontSize = m_enableAutoSizing ? m_fontSizeMax : m_fontSize;

    So when using a content size fitter to handle the Width it always calculates based on that maximum instead of using the actual text size leaving the width much wider than the text itself.

    I am wondering if this was intended to fix some other issue like and infinite loop of dirtied data or something? And if so is there any work arounds for this?

    Thanks a bunch

    upload_2022-7-19_11-1-4.png
     
  2. daxiongmao

    daxiongmao

    Joined:
    Feb 2, 2016
    Posts:
    412
    Just coming across this too. To bad no answer.