Search Unity

Bug The variable m_AtlasTextures of TMP_FontAsset doesn't exist anymore

Discussion in 'UGUI & TextMesh Pro' started by Gillissie, Feb 13, 2024.

  1. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    305
    I'm using a few dynamic fonts for Japanese, Chinese, Korean. They're set up as fallback fonts to my standard/non-Asian font. Sometimes, but not always, I get this error flooding my console. Here's the full call stack:

    MissingReferenceException: The variable m_AtlasTextures of TMP_FontAsset doesn't exist anymore.
    You probably need to reassign the m_AtlasTextures variable of the 'TMP_FontAsset' script in the inspector.
    TMPro.TMP_FontAsset.TryAddCharacterInternal (System.UInt32 unicode, TMPro.TMP_Character& character) (at Library/PackageCache/com.unity.textmeshpro@3.0.8/Scripts/Runtime/TMP_FontAsset.cs:2063)
    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.8/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.8/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.8/Scripts/Runtime/TMP_Text.cs:6147)
    TMPro.TextMeshProUGUI.SetArraySizes (TMPro.TMP_Text+UnicodeChar[] unicodeChars) (at Library/PackageCache/com.unity.textmeshpro@3.0.8/Scripts/Runtime/TMPro_UGUI_Private.cs:1209)
    TMPro.TMP_Text.ParseInputText () (at Library/PackageCache/com.unity.textmeshpro@3.0.8/Scripts/Runtime/TMP_Text.cs:1902)
    TMPro.TextMeshProUGUI.OnPreRenderCanvas () (at Library/PackageCache/com.unity.textmeshpro@3.0.8/Scripts/Runtime/TMPro_UGUI_Private.cs:1644)
    TMPro.TextMeshProUGUI.Rebuild (UnityEngine.UI.CanvasUpdate update) (at Library/PackageCache/com.unity.textmeshpro@3.0.8/Scripts/Runtime/TextMeshProUGUI.cs:216)
    UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at /Applications/Unity/Hub/Editor/2020.3.7f1/Unity.app/Contents/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/CanvasUpdateRegistry.cs:217)
    UnityEngine.UI.ScrollRect:LateUpdate() (at /Applications/Unity/Hub/Editor/2020.3.7f1/Unity.app/Contents/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/ScrollRect.cs:808)
     
  2. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    305
    By the way, it doesn't always stem from a ScrollRect. That just happens to be the stack I copied.
     
  3. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    305
  4. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    305
    After a little troubleshooting, it appears that the "Multi Atlas Textures" option being enabled is creating this issue. Index 1 in m_AtlasTextures is null.
     
  5. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    305
    Strangely, after I had unchecked multi textures, then re-checked it... it seems to be working correctly now.
     
  6. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    305
    An then randomly upon future plays, the bug starts happening again.
     
  7. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    498
    Hi @Gillissie! I'd recommend upgrading to TextMesh Pro 3.2.0-pre.8, the latest version of TMP. All bug fixes have landed in the 3.2.0 series for the past few years.

    If the issue still occurs, please log a ticket and we'll have a look!
     
  8. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    305
    The latest version that appears in the package manage is 3.0.8 from February 12, 2024 (much more recent than the past few years). Could you clarify whether 3.2.0-pre.8 is something not available through package manager for some reason?

    I should mention, I'm currently in Unity 2020 for this project.
     
    Last edited: Mar 25, 2024
  9. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    498
    Hey! You can learn more about the sate of TMP in the following forum post. As for using TMP 3.2.0-pre.x the steps are described at the beginning of this forum post.