NullReferenceException: Object reference not set to an instance of an object

Hi I’m getting this thousands of times. Version is Preview.8 2.1.0 using Unity 2019.3.13.

It is a small font asset with only a 20 or so characters. The text string is a single character in a textmeshproui object.

Any ideas?

Details below:
NullReferenceException: Object reference not set to an instance of an object
TMPro.TextMeshProUGUI.GenerateTextMesh () (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.8/Scripts/Runtime/TMPro_UGUI_Private.cs:2231)
TMPro.TextMeshProUGUI.OnPreRenderCanvas () (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.8/Scripts/Runtime/TMPro_UGUI_Private.cs:1768)
TMPro.TextMeshProUGUI.Rebuild (UnityEngine.UI.CanvasUpdate update) (at Library/PackageCache/com.unity.textmeshpro@2.1.0-preview.8/Scripts/Runtime/TextMeshProUGUI.cs:247)
UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at C:/Program Files/Unity/Hub/Editor/2019.3.13f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/CanvasUpdateRegistry.cs:210)
UnityEngine.Canvas:SendWillRenderCanvases()

It highlights TMPro_UGUI_Private.cs at line 2231:
uint nextGlyphIndex = m_textInfo.characterInfo[m_characterCount + 1].textElement.m_GlyphIndex;

Please check if you get the same behavior from Preview 12 which is the latest release available.

If you still get the issue, please submit a bug report with the included project and steps to reproduce. Once you get the case # from Unity via email, please provide it to me and I’ll take a look to figure out the cause of this behavior.

I don’t get this with the later version, thanks

1 Like