Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Bug TextMesh Pro AutoSize uses Max size for Preferred Width

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

  1. HaydenFerries


    Jun 27, 2019

    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