TMP Dynamic Font / Multi Atlas textures error: m_AtlasTexture has not been assigned

We use dynamic TMP font assets with multi atlas textures for Chinese, Japanese, Korean, etc. These are set as fallback fonts for our main latin fonts.

9821475--1411776--TMP_FallbackFont_GenerationSettings.png

When developers in editor switch to a language that uses fallback fonts, after some time TMP throws en exception:

UnassignedReferenceException: The variable m_AtlasTexture of TMP_FontAsset has not been assigned.

You probably need to assign the m_AtlasTexture variable of the TMP_FontAsset script in the inspector.

UnityEngine.Object.get_name () (at :0)

TMPro.TMP_FontAsset.SetupNewAtlasTexture () (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMP_FontAsset.cs:2415)

TMPro.TMP_FontAsset.TryAddCharacterInternal (System.UInt32 unicode, TMPro.TMP_Character& character) (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMP_FontAsset.cs:2118)

TMPro.TMP_FontAssetUtilities.GetCharacterFromFontAsset_Internal (System.UInt32 unicode, TMPro.TMP_FontAsset sourceFontAsset, System.Boolean includeFallbacks, TMPro.FontStyles fontStyle, TMPro.FontWeight fontWeight, System.Boolean& isAlternativeTypeface) (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMP_FontAssetUtilities.cs:159)

TMPro.TMP_FontAssetUtilities.GetCharacterFromFontAssets (System.UInt32 unicode, TMPro.TMP_FontAsset sourceFontAsset, System.Collections.Generic.List`1[T] fontAssets, System.Boolean includeFallbacks, TMPro.FontStyles fontStyle, TMPro.FontWeight fontWeight, System.Boolean& isAlternativeTypeface) (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMP_FontAssetUtilities.cs:241)

TMPro.TMP_Text.GetTextElement (System.UInt32 unicode, TMPro.TMP_FontAsset fontAsset, TMPro.FontStyles fontStyle, TMPro.FontWeight fontWeight, System.Boolean& isUsingAlternativeTypeface) (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMP_Text.cs:6147)

TMPro.TextMeshProUGUI.SetArraySizes (TMPro.TMP_Text+UnicodeChar[ ] unicodeChars) (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMPro_UGUI_Private.cs:1209)

TMPro.TMP_Text.ParseInputText () (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMP_Text.cs:1902)

TMPro.TextMeshProUGUI.OnPreRenderCanvas () (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMPro_UGUI_Private.cs:1644)

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()

With the inspector in debug mode > In the fallback font asset > In the Atlas Textures Array: In the moment that the exception occurs, there are two entries, and the second is a type mismatch.

9821475--1411785--TMP_Error_01.png

When continuing to play and toggling additional text, there are additional entries added, which are also a type mismatch or none.

9821475--1411779--TMP_Error_02.png
9821475--1411779--TMP_Error_02.png
In some cases, when this issue appears, characters of the fallback font are not displayed in the scene.

The issue doesn’t seem to appear in builds.
We have tried resetting the font assets multiple times and de- and enabled multi atlas textures, which fixes the error for the current editor session, but when Unity has been closed and opened again, or other people check out the branch, the behaviour appears again.

Maybe unrelated, but after playing the game in a language that uses fallback fonts, and closing the editor, these font assets appear as changed in version control.

Does anyone know how this error can be fixed or prevented?

9821475--1411788--TMP_Error_02.png

I’m facing with the same issue, it made a lot of non-fatal warning on Firebase Crashlytics. Anyone know how to fix it?

Hi, I have the same error now, is there any updates?