TMP Sprite Error

Has anyone seen an issue like this before?

Placing sprites in text using a typewriting effect causes an error sometimes.

This is the error:

NullReferenceException: Object reference not set to an instance of an object
TMPro.TextMeshProUGUI.GenerateTextMesh () (at Library/PackageCache/com.unity.textmeshpro@3.0.4/Scripts/Runtime/TMPro_UGUI_Private.cs:2014)
TMPro.TextMeshProUGUI.OnPreRenderCanvas () (at Library/PackageCache/com.unity.textmeshpro@3.0.4/Scripts/Runtime/TMPro_UGUI_Private.cs:1660)
TMPro.TextMeshProUGUI.ForceMeshUpdate (System.Boolean ignoreActiveState, System.Boolean forceTextReparsing) (at Library/PackageCache/com.unity.textmeshpro@3.0.4/Scripts/Runtime/TextMeshProUGUI.cs:547)

Example text:
launch codes
We need to intercept the launch codes before the enemy launches their weapon at our home world.

with sprite number
with sprite name

Sometimes no error pops up but the text gets scrambled.

Usually, the sprites still show, but the text next to it breaks.

Deleting and then re-importing TMP files can temporarily fix it, but it soon comes back then continues, as though it were altering the files themselves. In other words, the problem seems to get worse after repeatedly trying the same thing.

If I remove the sprites from the text completely, everything works as intended.

I've submitted a bug report, but they've only suggested the re-import fix.

If you can post the Case # of this report, I can take a closer look as soon as I have a chance.

P.S. What version of the TMP package and Unity are you using?

(Case 1326754)

Unity Version: 2020.3.0f1
TMP... how do I check? I just reimported it yesterday, so I assume the latest version.
The user guide says Release 1.0.54

You would check via the Package Manager located in the Window menu.



I’ll try looking at that case later tonight / over the new few days if I can’t get to it tonight.