Search Issue Tracker

Fixed in 1.6.0-preview.1, 2.2.0-preview.1, 3.2.0-preview.1

Votes

4

Found in [Package]

3.0.6

Issue ID

1326754

Regression

No

[TextMeshPro] Using <font> and <sprite name> Rich Text tags throws a NullReferenceException

Package: TextMeshPro

-

How to reproduce:
1. Open the attached project named "Case_1326754"
2. Open the "DemoScene1"
3. Observe the Console window. If no error message is thrown, enter Play mode

Expected results: No errors are thrown and the text is correctly displayed in Scene and Game windows
Actual results: NullReferenceException is thrown and the text is not rendered

Reproducible with: 1.4.1(2018.4.35f1), 2.1.6(2019.4.26f1), 3.0.6(2020.3.8f1, 2021.1.7f1, 2021.2.0a17)

Notes:
1. The error in the test project seems to be caused by a <font> and <sprite name="Smiling face with smiling eyes"> tags combination

Full error message:
NullReferenceException: Object reference not set to an instance of an object
TMPro.TextMeshProUGUI.GenerateTextMesh () (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMPro_UGUI_Private.cs:2024)
TMPro.TextMeshProUGUI.OnPreRenderCanvas () (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMPro_UGUI_Private.cs:1670)
TMPro.TextMeshProUGUI.Rebuild (UnityEngine.UI.CanvasUpdate update) (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TextMeshProUGUI.cs:216)
UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/CanvasUpdateRegistry.cs:217)
UnityEngine.Canvas:SendWillRenderCanvases()

  1. Resolution Note (fix version 1.6.0-preview.1, 2.2.0-preview.1, 3.2.0-preview.1):

    Fixed in: 2019.4.29f1 (2.2.0-preview.1), 2020.3.18f1 (3.2.0-preview.1)

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.