Search Issue Tracker

Fixed in 2021.2.X



Found in



Issue ID




UI Toolkit window text disappears and throw MissingReferenceException on reimport on Windows with Editor Font set to System Font

UI Toolkit


Steps to reproduce:
1. Create/Open any Unity project
2. Make sure "System Font" Editor Font is selected in Preferences
3. Open Window -> UI Toolkit -> Samples
4. Enter and exit Play Mode

Expected result: UI is rendered as expected, no errors are thrown
Actual result: Open UI Toolkit windows throw MissingReferenceException errors, UI becomes corrupted and text is not rendered

Reproduced with: 2021.2.0a17, 2021.2.0a14
Didn't reproduce on: 2021.2.0a13, 2021.1.8f1, 2020.3.9f1, 2019.4.27f1

Note: Only reproduced on Windows with System Font, all fonts on macOS work as expected.

MissingReferenceException: The object of type 'Material' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Object.get_name () (at <b603aff9c08241b8beccabaa6d7037b0>:0)
UnityEngine.UIElements.UIR.Implementation.UIRStylePainter.DrawTextCore (UnityEngine.UIElements.MeshGenerationContextUtils+TextParams textParams, UnityEngine.UIElements.ITextHandle handle, System.Single pixelsPerPoint) (at <d98a0f9d3a9a450c9f1ea4983cb665e9>:0)
UnityEngine.UIElements.UIR.Implementation.UIRStylePainter.DrawText (UnityEngine.UIElements.MeshGenerationContextUtils+TextParams textParams, UnityEngine.UIElements.ITextHandle handle, System.Single pixelsPerPoint) (at <d98a0f9d3a9a450c9f1ea4983cb665e9>:0)
UnityEngine.UIElements.MeshGenerationContextUtils.Text (UnityEngine.UIElements.MeshGenerationContext mgc, UnityEngine.UIElements.MeshGenerationContextUtils+TextParams textParams, UnityEngine.UIElements.ITextHandle handle, System.Single pixelsPerPoint) (at <d98a0f9d3a9a450c9f1ea4983cb665e9>:0)
UnityEngine.UIElements.TextElement.OnGenerateVisualContent (UnityEngine.UIElements.MeshGenerationContext mgc) (at <d98a0f9d3a9a450c9f1ea4983cb665e9>:0)
UnityEngine.UIElements.VisualElement.InvokeGenerateVisualContent (UnityEngine.UIElements.MeshGenerationContext mgc) (at <d98a0f9d3a9a450c9f1ea4983cb665e9>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.