Search Unity

  1. Click here to receive a gift with your purchase of Unity Pro or Unity Enterprise.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

TextMesh Pro Bug: <br> Tag and Overflow mode "Truncate" causes StackOverflow Exception

Discussion in 'UGUI & TextMesh Pro' started by odysoftware, Aug 15, 2019.

  1. odysoftware

    odysoftware

    Joined:
    Jul 21, 2015
    Posts:
    60
    There is a bug in TMP 2.0.1 from latest Unity Version 2019.2.0 - which causes a StackOverflow in TMPro.

    Code (CSharp):
    1. StackOverflowException: The requested operation caused a stack overflow.
    2. UnityEngine.Object.EnsureRunningOnMainThread () (at /Users/builduser/buildslave/unity/build/Runtime/Export/Scripting/UnityEngineObject.bindings.cs:147)
    3. UnityEngine.Object.GetInstanceID () (at /Users/builduser/buildslave/unity/build/Runtime/Export/Scripting/UnityEngineObject.bindings.cs:68)
    4. TMPro.MaterialReference..ctor (System.Int32 index, TMPro.TMP_FontAsset fontAsset, TMPro.TMP_SpriteAsset spriteAsset, UnityEngine.Material material, System.Single padding) (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/MaterialReferenceManager.cs:545)
    5. TMPro.TextMeshProUGUI.GenerateTextMesh () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:1699)
    6. TMPro.TextMeshProUGUI.GenerateTextMesh () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:2733)
    7. TMPro.TextMeshProUGUI.GenerateTextMesh () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:2733)
    8. TMPro.TextMeshProUGUI.GenerateTextMesh () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:2733)
    9. TMPro.TextMeshProUGUI.GenerateTextMesh () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:2733)
    10. TMPro.TextMeshProUGUI.GenerateTextMesh () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:2733)
    11. TMPro.TextMeshProUGUI.GenerateTextMesh ().........
    Its should be easy to reproduce
    - Add a new UI -> Text - TextMeshPro Element to the scene
    - Switch Overflow mode to "Truncate"
    - Resize the object so that at least 2 or more lines of text will fit in scene view
    - Add a few lines of text
    - Now add a <br> tag in one of the first lines so that some text after the <br> will move outside the area (it gets truncates).
    - the error should appear.
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,085
    Good timing.

    I just happened to be re-working the line breaking handling to address a potential issue with Soft Hyphenation and Text Auto-sizing as well as remove the use of recursion and improve performance when using Truncate, Ellipsis, Soft Hyphenation, etc.

    I just tested the above in 1.4.1 and was able to reproduce the issue. Did the same testing in the latest release I am working on with the above changes and it works correctly.

    The above issue will be resolved in the next release of the TMP package. This will be version 2.1.0 and not 2.0.2 as it includes important changes / improvements.

    I am hoping to have this release out in preview within the next 7 days (provided I don't run into any unforeseen issues). Ie. I am close but want to make sure it is good first :)
     
  3. odysoftware

    odysoftware

    Joined:
    Jul 21, 2015
    Posts:
    60
    That sounds great thanks :)
     
  4. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    808
  5. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,085
    Today is my final day of testing on the new release. Unless I run into some unforeseen issue (today) I am planning on releasing the new package tomorrow.
     
    MrLucid72 likes this.
  6. ooochris

    ooochris

    Joined:
    Jul 21, 2013
    Posts:
    5
    Any update on this? Version 2.1 is still in preview. Any plan for the release?
     
  7. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,085
    Preview 3 is now available. I would strongly recommend testing with Preview 3 and if all is good to go with that version until the final release is available.
     
  8. AArtlone

    AArtlone

    Joined:
    Dec 3, 2018
    Posts:
    4
    Sorry to ask. Any news on when version 2.1.0 will be released
     
  9. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,085
    Preview 14 is the last preview release.

    I am now working on the final non preview releases which includes version 1.5.0, 2.1.0 and 3.0.0.
     
  10. Democide

    Democide

    Joined:
    Jan 29, 2013
    Posts:
    311
    I am still on 2018.4, do you have an estimate for when this is fixed there? I seem to have a similar issue
     
  11. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,085
    Within the next few days.
     
unityunity