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.

Bug In the Inspector, change the TextMeshPro component text to report an error null pointer reference

Discussion in 'UGUI & TextMesh Pro' started by K36-ui, Nov 17, 2022.

  1. K36-ui

    K36-ui

    Joined:
    Nov 17, 2022
    Posts:
    2
    Error content:
    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:3464)
    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:215)
    UnityEngine.Canvas:SendWillRenderCanvases() 捕获2.PNG

    When I changed to Chinese text, Unity reported an error, English is fine, please see what happens.
    It's maddening to find a question about it online at all

    To add again, the editor version is 2021.3.2f1c1

    The fonts use a static font library generated by the online tutorial
    捕获1.PNG
     

    Attached Files:

  2. K36-ui

    K36-ui

    Joined:
    Nov 17, 2022
    Posts:
    2
    All right, I'll take care of it myself.
    Just a file is damaged or missing, delete TextMeshPro under Assets and import it again.