I’m having some trouble with TextMeshProUGUI not rendering any text meshes in the scene after I change the text string via code in play mode. When this happens, the text shows correctly in the inspector, but does not show in the scene view:
When the SceneView is set to wireframe, it looks the same, no meshes are generated. The issue may happen silently, without any errors, but sometimes I also see an exception logged to the console:
NullReferenceException: Object reference not set to an instance of an object
TMPro.TextMeshProUGUI.GenerateTextMesh () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:2094)
TMPro.TextMeshProUGUI.GenerateTextMesh () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:2791)
TMPro.TextMeshProUGUI.OnPreRenderCanvas () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:1656)
TMPro.TextMeshProUGUI.Rebuild (UnityEngine.UI.CanvasUpdate update) (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TextMeshProUGUI.cs:209)
UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at C:/Program Files/Unity/Hub/Editor/2019.2.17f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/CanvasUpdateRegistry.cs:198)
UnityEngine.Canvas:SendWillRenderCanvases() (at C:/buildslave/unity/build/Modules/UI/ScriptBindings/UICanvas.bindings.cs:72)
In the TMP source code it looks as if the components material reference is null, however, the font and material are all correctly assigned.
Any idea what could be going wrong here and how I can narrow this down? I’m currently trying to reproduce a case in a clean scene, but it only seems to happen for specific text strings at specific times in the game.
