Search Unity

TextMesh Pro TextMeshPro 2.0.1 regression (from 2.0.0)

Discussion in 'UGUI & TextMesh Pro' started by HowlingMoonSoftware, Jul 16, 2019.

  1. HowlingMoonSoftware

    HowlingMoonSoftware

    Joined:
    Sep 29, 2016
    Posts:
    5
    Hi,
    I'm reporting a regression here, in addition to via the Unity Bug Reporter. The documentation ( https://docs.unity3d.com/Packages/com.unity.textmeshpro@2.0/manual/index.html ) indicates that this is the best place for support requests. I'm not sure if issues in packages are supposed to go through the Unity bug reporter.

    This is Fogbugz Case 1170085. If you aren't able to access this, I can send you the replication project directly.

    The behavior for sizing a rect transform to match text has changed between version 2.0.0 and 2.0.1. Switching between the version is easy using the Unity Package Manager, and only takes 5 seconds or so.

    The issue is demonstrated in these images.






    In this tiny replication project, we have a set of layout groups and layout elements. In 2.0.1, the "Label Text (Left)" game object should resize itself the way it did in version 2.0.0.

    I believe this regression was unintentional because there wasn't a behavior change mentioned in the release notes here: https://docs.unity3d.com/Packages/com.unity.textmeshpro@2.0/changelog/CHANGELOG.html
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I did make changes in the latest release to add support for Layout components. Unfortunately, the change made it in but not the notes in the ChangeLog.

    Additional changes to better handle Layout components will also be coming in the next package release.

    Having said that, I am looking into your setup to try to understand it as well as the impact of the changes.

    I did revised the structure of your prefab / scene to work in 2.0.1. The attached package containing the revised scene should load / import in the project you provided.

    upload_2019-7-16_21-52-21.png

    One code change is needed in the TMP_InputField.cs which is as follows to remove the added value of 16.

    Code (csharp):
    1.  
    2. public virtual float preferredHeight
    3. {
    4.      get
    5.      {
    6.           if (textComponent == null)
    7.                return 0;
    8.        
    9.           // Remove the + 16 from the line below.    
    10.           return m_TextComponent.preferredHeight + 16;
    11.      }
    12. }
    13.  
    Support for layout components with the Input Field is still in flux. I will be checking this revised setup against the latest revision I have. Also see if the modified setup makes sense to you.

    Update
    Tested the revised structure in the latest version I am working with and the results are the same as above.

    upload_2019-7-16_22-3-46.png

    Since your Form Content is a Vertical Layout Group, I am assuming you might be inserting more groups in there so I also tested duplicates of the Session ID which also lays out correctly.

    The revised structure doesn't support the Input Field expanding horizontally but that will work in the new release by simply adding a content size fitter on the Input Field itself.
     

    Attached Files:

    Last edited: Jul 17, 2019
  3. HowlingMoonSoftware

    HowlingMoonSoftware

    Joined:
    Sep 29, 2016
    Posts:
    5
    Hi Stephan!
    Thanks so much for looking at this. I will pass the revised prefab to our UI guy, who is back in the office on Monday. We aren't sure if we will make the change to everything in the UI since it's kind of a large project. (this was just the most easily isolated example of the issue, although a lot of the UI in this project follows a similar pattern, as you suspected).

    The setup is definitely a bit complicated and highly nuanced, so I figured that example would serve as a good regression test.

    Will the behavior of TextMeshPro 2.0.2 match 2.0.0, or should we assume the behavior in 2.0.1+ will require the revisions you suggested? It's not a huge deal- just wanted to check before changing the UI objects.

    Thanks a lot for the speedy reply!
    -Andy
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I made additional tweaks to further clean up the structure.

    upload_2019-7-18_14-50-34.png

    The key change is having the Label and Input Field be separate elements in the hierarchy and controlled by their parent horizontal layout group. In the original structure, the input field was mixed with the label and all.

    I included the revised scene which should import fine since it uses the same assets.

    In terms of moving forward, the new release (2.0.2) will match the 2.0.1 and not 2.0.0 which didn't properly support layout components.

    Again, please be sure to review the changes and provide feedback.
     

    Attached Files:

  5. m_gravelle

    m_gravelle

    Joined:
    Apr 30, 2013
    Posts:
    8
    Thanks for these fixes. It does work now after a bit of tinkering. I haven't thoroughly tested how well the horizontal auto-sizing works but for our purposes at the moment everything looks back to normal.

    Some minor feedback: I did have some problems implementing your fix initially. Turns out the UI wasn't updating but it was solved by, for example, changing the text alignment in the inspector and then changing it back and that forced it to redraw.