Search Unity

TextMeshPro Text positioning changing when upgrading.

Discussion in 'UGUI & TextMesh Pro' started by sgower, Dec 27, 2020.

  1. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    Has anyone has problems with TextMeshPro text changing after a Unity upgrade? I have a lot of Text in my project and after a couple different upgrades I'm seeing many cases where the text positioning gets messed up during the upgrade process.

    For example, I'll have a text box that doesn't wrap before the upgrade, and then after the upgrade (I think because the text size changes), the text will wrap.

    Is this a known issue? It's pretty aggravating. I could provide a specific example with a "before" and "after" along with all the settings, but I'm wondering if this is something others have dealt with.

    Thanks.
     
  2. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    Hi, so I decided to provide some additional information. You can see how the text is wrapping after the upgrade.
    It's not too much of a problem to fix one or two of these, but when you have lots of text boxes with out of place text, it starts to become a real hassle. I don't remember when it happened, but I know I face a similar issue on a previous Unity update and I bit the bullet and manually fixed everything. I believe I'll need to do the same this time around, but it would be nice to not see issues like this. Any thoughts about this Stephen?


    Before Unity Version: Unity 2019 3.13.f1
    After Unity Version: Unity 2019 4.9f1



    Before Upgrade:

    upload_2020-12-27_12-46-50.png
    After Upgrade:

    upload_2020-12-27_12-47-8.png


    I have at last a couple of dozen cases where the UI text has changed.

    Here is the GameObject for this example. Hopefully, you can read the text in these images, but here is the before and after for the game object.
    As far as I can see, all the values match exactly.


    Left, before Unity update:
    Right, after Unity update:
    upload_2020-12-27_12-54-27.png

    More from the game object. Most values look the same. For some reason the Face Color and Outline Color both now say "HDR" which is different. There is also a new "Style Sheet Asset" item in the "After"

    upload_2020-12-27_12-59-12.png



    Here is the Font asset. Again unless I'm missing something, it looks like the values are matching.
    Left:Before Upgrade
    Right:After Upgrade

    upload_2020-12-27_12-51-35.png

    Hopefully I've provided enough information. Thanks in advance for your help!
     
  3. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    I should probably also mention that my project is using TMP 2.1.1
    Perhaps Upgrading before the Unity update would have helped prevent this issue?

    upload_2020-12-27_13-15-6.png
     
  4. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    Another thing I have observed:

    When I open up my older 2019.3.13f1 project, I see that it was actually using TextMeshPro 2.0.1

    When I change it to use 2.1.3, then the text in this example also wraps, but the alignment also changes from Center to Left:

    upload_2020-12-27_16-52-22.png


    So that seems like a bug in the TMP upgrade process.
     
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I believe the initial issue is related to changes in 2.1.x related to spacing values which in the past were inconsistent and fixed in the 2.1.x releases. This spacing change would affect bold spacing which is defined per font asset. Since the screenshots of text object your referenced uses bold, I believe the issue should be resolved by adjusting the bold spacing which is 7 to a slightly smaller value.

    Line spacing would also be affected by this change which I recommend reviewing as well.

    Minor recommendation, the scaling of your text objects is such that it requires you use a small point size like 2.5 which can be problematic when using auto-size and other spacing type properties. I recommend always keeping the text object scale at (1, 1, 1) and scaling the parent instead.

    In regards to the alignment issue, in the 2.1.x releases, text alignment was split between horizontal and vertical so these can be controlled and serialized separately. The conversion from one to the other happens automatically. However, if you revert back to a previous release after this conversion to 2.1.x, then alignment will be incorrect. Are you able to go back to a backup of the project prior to upgrading / reverting back to 2.0.1? Going back to this backup and then upgrading to 2.1.3 should resolve the alignment issue. Then adjusting the bold spacing for your font asset should resolve the wrapping issue.

    Let me know if the above worked?
     
  6. sgower

    sgower

    Joined:
    Mar 9, 2015
    Posts:
    316
    Hi, thanks for your response. At this point, I've updated my project to use 2.1.3 and spent a couple of hours visiting all the places with text positioning issues and making the necessary adjustments. I'm still not done, but I've made some good progress. It sounds like the changes I'm seeing were the result of you fixing other issues. Hopefully, after making this latest adjustment, that future upgrades won't have this issue. It's not really the end of the world to go and make these kinds of corrections, but it's a bit alarming to upgrade unity and then have lots of text look bad. Thanks a lot. It's a great asset and It's very good that it's now part of Unity.
     
  7. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I certainly agree and apologize for inconvenience resulting from this change. This was one of those changes that I had been postponing for a while which I ultimately had to make. See the following excerpt from another thread related to this change.

     
  8. pedroareias16

    pedroareias16

    Joined:
    Mar 7, 2018
    Posts:
    3