Search Unity

Bug MissingReferenceException: The variable m_AtlasTextures of TMP_FontAsset doesn't exist anymore.

Discussion in 'UGUI & TextMesh Pro' started by Hyp-X, Aug 5, 2022.

  1. Hyp-X

    Hyp-X

    Joined:
    Jun 24, 2015
    Posts:
    438
    Hi,

    When using dynamic fonts in the editor, after a while a spam of these errors start to appear:
    (and the UI falls appart)

    Code (CSharp):
    1. MissingReferenceException: The variable m_AtlasTextures of TMP_FontAsset doesn't exist anymore.
    2. You probably need to reassign the m_AtlasTextures variable of the 'TMP_FontAsset' script in the inspector.
    3. UnityEngine.Object.get_name () (at <4a31731933e0419ca5a995305014ad37>:0)
    4. TMPro.TMP_MaterialManager.GetFallbackMaterial (TMPro.TMP_FontAsset fontAsset, UnityEngine.Material sourceMaterial, System.Int32 atlasIndex) (at Library/PackageCache/com.unity.textmeshpro@3.2.0-pre.3/Scripts/Runtime/TMP_MaterialManager.cs:370)
    5. TMPro.TextMeshProUGUI.SetArraySizes (TMPro.TMP_Text+TextProcessingElement[] textProcessingArray) (at Library/PackageCache/com.unity.textmeshpro@3.2.0-pre.3/Scripts/Runtime/TMPro_UGUI_Private.cs:1398)
    6. TMPro.TMP_Text.ParseInputText () (at Library/PackageCache/com.unity.textmeshpro@3.2.0-pre.3/Scripts/Runtime/TMP_Text.cs:1965)
    7. TMPro.TMP_Text.GetPreferredWidth () (at Library/PackageCache/com.unity.textmeshpro@3.2.0-pre.3/Scripts/Runtime/TMP_Text.cs:3601)
    8. TMPro.TMP_Text.get_preferredWidth () (at Library/PackageCache/com.unity.textmeshpro@3.2.0-pre.3/Scripts/Runtime/TMP_Text.cs:1439)
    9. UnityEngine.UI.LayoutUtility+<>c.<GetPreferredWidth>b__4_1 (UnityEngine.UI.ILayoutElement e) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Layout/LayoutUtility.cs:68)
    10. UnityEngine.UI.LayoutUtility.GetLayoutProperty (UnityEngine.RectTransform rect, System.Func`2[T,TResult] property, System.Single defaultValue, UnityEngine.UI.ILayoutElement& source) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Layout/LayoutUtility.cs:161)
    11. UnityEngine.UI.LayoutUtility.GetLayoutProperty (UnityEngine.RectTransform rect, System.Func`2[T,TResult] property, System.Single defaultValue) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Layout/LayoutUtility.cs:129)
    12. UnityEngine.UI.LayoutUtility.GetPreferredWidth (UnityEngine.RectTransform rect) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Layout/LayoutUtility.cs:68)
    13. UnityEngine.UI.LayoutUtility.GetPreferredSize (UnityEngine.RectTransform rect, System.Int32 axis) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Layout/LayoutUtility.cs:31)
    14. UnityEngine.UI.HorizontalOrVerticalLayoutGroup.GetChildSizes (UnityEngine.RectTransform child, System.Int32 axis, System.Boolean controlSize, System.Boolean childForceExpand, System.Single& min, System.Single& preferred, System.Single& flexible) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Layout/HorizontalOrVerticalLayoutGroup.cs:233)
    15. UnityEngine.UI.HorizontalOrVerticalLayoutGroup.CalcAlongAxis (System.Int32 axis, System.Boolean isVertical) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Layout/HorizontalOrVerticalLayoutGroup.cs:104)
    16. UnityEngine.UI.VerticalLayoutGroup.CalculateLayoutInputHorizontal () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Layout/VerticalLayoutGroup.cs:18)
    17. UnityEngine.UI.LayoutRebuilder+<>c.<Rebuild>b__12_0 (UnityEngine.Component e) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Layout/LayoutRebuilder.cs:85)
    18. UnityEngine.UI.LayoutRebuilder.PerformLayoutCalculation (UnityEngine.RectTransform rect, UnityEngine.Events.UnityAction`1[T0] action) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Layout/LayoutRebuilder.cs:160)
    19. UnityEngine.UI.LayoutRebuilder.PerformLayoutCalculation (UnityEngine.RectTransform rect, UnityEngine.Events.UnityAction`1[T0] action) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Layout/LayoutRebuilder.cs:157)
    20. UnityEngine.UI.LayoutRebuilder.Rebuild (UnityEngine.UI.CanvasUpdate executing) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Layout/LayoutRebuilder.cs:85)
    21. UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/CanvasUpdateRegistry.cs:181)
    22. UnityEngine.Canvas:SendWillRenderCanvases()
    Stop play mode and start again doesn't solve the issue, I have to restart the editor when it happens, then it will work -- for a while.
    I have no reports of this happening in build, only the editor.

    We are using Unity 2021.3.6f1 with TMP 3.2.0-pre.3
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Are you able to reliably reproduce this behavior? If so, I would suggest submitting a bug report with project to enable us to take a closer look.

    Let me know if you are able to submit a bug report.
     
  3. seniorbuger

    seniorbuger

    Joined:
    Jun 23, 2023
    Posts:
    1
    I also encountered this problem. I just saw a 2015 post discussing this problem, and I found that this problem will only appear in languages other than English (such as Chinese, Korean, Japanese) for 7 years!! Don't unity fix this bug yet?!! When the script displays a large number of variables in the inspector, this bug is more likely to occur. The input boxes of all affected variables will become abnormally narrow, allowing for input, but you cannot see the input content, and the variable name will also disappear. I think I must learn English (this passage is Machine translation)