I got the issue and the following is the stack trace.
MissingReferenceException: The variable m_AtlasTextures of FontAsset doesn't exist anymore.
You probably need to reassign the m_AtlasTextures variable of the 'FontAsset' script in the inspector.
UnityEngine.Object.get_name () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnityEngineObject.bindings.cs:194)
UnityEngine.TextCore.Text.MaterialManager.GetFallbackMaterial (UnityEngine.TextCore.Text.FontAsset fontAsset, UnityEngine.Material sourceMaterial, System.Int32 atlasIndex) (at /Users/bokken/buildslave/unity/build/Modules/TextCoreTextEngine/Managed/MaterialManager.cs:74)
UnityEngine.TextCore.Text.TextGenerator.SetArraySizes (System.Int32[] chars, UnityEngine.TextCore.Text.TextGenerationSettings generationSettings, UnityEngine.TextCore.Text.TextInfo textInfo) (at /Users/bokken/buildslave/unity/build/Modules/TextCoreTextEngine/Managed/TextGenerator.cs:4873)
UnityEngine.TextCore.Text.TextGenerator.Prepare (UnityEngine.TextCore.Text.TextGenerationSettings generationSettings, UnityEngine.TextCore.Text.TextInfo textInfo) (at /Users/bokken/buildslave/unity/build/Modules/TextCoreTextEngine/Managed/TextGenerator.cs:543)
UnityEngine.TextCore.Text.TextGenerator.GenerateText (UnityEngine.TextCore.Text.TextGenerationSettings settings, UnityEngine.TextCore.Text.TextInfo textInfo) (at /Users/bokken/buildslave/unity/build/Modules/TextCoreTextEngine/Managed/TextGenerator.cs:314)
UnityEngine.UIElements.TextCoreHandle.Update (UnityEngine.UIElements.MeshGenerationContextUtils+TextParams parms, System.Single pixelsPerPoint) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Text/TextHandle.cs:249)
UnityEngine.UIElements.UIR.Implementation.UIRStylePainter.DrawTextCore (UnityEngine.UIElements.MeshGenerationContextUtils+TextParams textParams, UnityEngine.UIElements.ITextHandle handle, System.Single pixelsPerPoint) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Renderer/UIRStylePainter.cs:412)
UnityEngine.UIElements.UIR.Implementation.UIRStylePainter.DrawText (UnityEngine.UIElements.MeshGenerationContextUtils+TextParams textParams, UnityEngine.UIElements.ITextHandle handle, System.Single pixelsPerPoint) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Renderer/UIRStylePainter.cs:380)
UnityEngine.UIElements.MeshGenerationContextUtils.Text (UnityEngine.UIElements.MeshGenerationContext mgc, UnityEngine.UIElements.MeshGenerationContextUtils+TextParams textParams, UnityEngine.UIElements.ITextHandle handle, System.Single pixelsPerPoint) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Renderer/UIRMeshGenerationContext.cs:740)
UnityEngine.UIElements.TextElement.OnGenerateVisualContent (UnityEngine.UIElements.MeshGenerationContext mgc) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/TextElement.cs:188)
UnityEngine.UIElements.VisualElement.InvokeGenerateVisualContent (UnityEngine.UIElements.MeshGenerationContext mgc) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/VisualElement.cs:1535)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
I dug & dug and got the following situation.
Start UnityEditor.
Run play mode and all things are okay.
Run play mode again and the error came out. “MissingReferenceException: The variable m_AtlasTextures of FontAsset doesn’t exist anymore.”
Find out the point when the exception is thrown. > The atlasIndex is 1 which is null (abnormal)
The follow image shows that some garbage is appended at secondary play mode.
How can I resolve or avoid this issue?
The font contains Korean and used UI Toolkit.
Unity version is 2021.3.11f1.
The errors are too excessive, I cannot view my own exceptions.
I found this post related to Text Mesh Pro for which FontAsset are almost identical to what’s used inside UI Toolkit.
There are some suggestions in there to re-create the asset: MissingReferenceException: The variable m_AtlasTextures of TMP_FontAsset doesn't exist anymore.
If you have some consistent reproduction steps reporting a bug through Unity (“Help > Report a bug”) would be much appreciated.
1 Like
antoine-unity:
I found this post related to Text Mesh Pro for which FontAsset are almost identical to what’s used inside UI Toolkit.
There are some suggestions in there to re-create the asset: https://discussions.unity.com/t/829304
If you have some consistent reproduction steps reporting a bug through Unity (“Help > Report a bug”) would be much appreciated.
Yes, I also found that issue.
I did same thing font reset , font recreate , add some script codes enter/exit playmode to clear font related resources .
In this case, situation is identical except this is occurred in FontAsset instead of TMP_FontAsset .
It is a good suggestion to report a bug, I will do that, Thank you~!
DrabanL
February 22, 2023, 7:15pm
4
I am having the same issue.
Any update on that?
Hi @DrabanL !
You can follow the progress on this issue from this ticket .
This issue is so annoying, having the same problem trying to implement Chinese fonts on my app
peteruxt:
I got the issue and the following is the stack trace.
MissingReferenceException: The variable m_AtlasTextures of FontAsset doesn't exist anymore.
You probably need to reassign the m_AtlasTextures variable of the 'FontAsset' script in the inspector.
UnityEngine.Object.get_name () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnityEngineObject.bindings.cs:194)
UnityEngine.TextCore.Text.MaterialManager.GetFallbackMaterial (UnityEngine.TextCore.Text.FontAsset fontAsset, UnityEngine.Material sourceMaterial, System.Int32 atlasIndex) (at /Users/bokken/buildslave/unity/build/Modules/TextCoreTextEngine/Managed/MaterialManager.cs:74)
UnityEngine.TextCore.Text.TextGenerator.SetArraySizes (System.Int32[] chars, UnityEngine.TextCore.Text.TextGenerationSettings generationSettings, UnityEngine.TextCore.Text.TextInfo textInfo) (at /Users/bokken/buildslave/unity/build/Modules/TextCoreTextEngine/Managed/TextGenerator.cs:4873)
UnityEngine.TextCore.Text.TextGenerator.Prepare (UnityEngine.TextCore.Text.TextGenerationSettings generationSettings, UnityEngine.TextCore.Text.TextInfo textInfo) (at /Users/bokken/buildslave/unity/build/Modules/TextCoreTextEngine/Managed/TextGenerator.cs:543)
UnityEngine.TextCore.Text.TextGenerator.GenerateText (UnityEngine.TextCore.Text.TextGenerationSettings settings, UnityEngine.TextCore.Text.TextInfo textInfo) (at /Users/bokken/buildslave/unity/build/Modules/TextCoreTextEngine/Managed/TextGenerator.cs:314)
UnityEngine.UIElements.TextCoreHandle.Update (UnityEngine.UIElements.MeshGenerationContextUtils+TextParams parms, System.Single pixelsPerPoint) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Text/TextHandle.cs:249)
UnityEngine.UIElements.UIR.Implementation.UIRStylePainter.DrawTextCore (UnityEngine.UIElements.MeshGenerationContextUtils+TextParams textParams, UnityEngine.UIElements.ITextHandle handle, System.Single pixelsPerPoint) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Renderer/UIRStylePainter.cs:412)
UnityEngine.UIElements.UIR.Implementation.UIRStylePainter.DrawText (UnityEngine.UIElements.MeshGenerationContextUtils+TextParams textParams, UnityEngine.UIElements.ITextHandle handle, System.Single pixelsPerPoint) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Renderer/UIRStylePainter.cs:380)
UnityEngine.UIElements.MeshGenerationContextUtils.Text (UnityEngine.UIElements.MeshGenerationContext mgc, UnityEngine.UIElements.MeshGenerationContextUtils+TextParams textParams, UnityEngine.UIElements.ITextHandle handle, System.Single pixelsPerPoint) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/Renderer/UIRMeshGenerationContext.cs:740)
UnityEngine.UIElements.TextElement.OnGenerateVisualContent (UnityEngine.UIElements.MeshGenerationContext mgc) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/TextElement.cs:188)
UnityEngine.UIElements.VisualElement.InvokeGenerateVisualContent (UnityEngine.UIElements.MeshGenerationContext mgc) (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Core/VisualElement.cs:1535)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
I dug & dug and got the following situation.
Start UnityEditor.
Run play mode and all things are okay.
Run play mode again and the error came out. “MissingReferenceException: The variable m_AtlasTextures of FontAsset doesn’t exist anymore.”
Find out the point when the exception is thrown. > The atlasIndex is 1 which is null (abnormal)
The follow image shows that some garbage is appended at secondary play mode.
How can I resolve or avoid this issue?
The font contains Korean and used UI Toolkit.
Unity version is 2021.3.11f1.
The errors are too excessive, I cannot view my own exceptions.
I am suffering from this exact same issue still on Unity 2023.1.9f1, so the bug was never truly fixed or it came back
Hi @joseGuate97_1 ! It seems like the fix wasn’t brought back to TextMeshPro. I’m not sure if this was the issue in your case, but I’ve just backported it, and it will be included in version 3.2.0-pre.7.