Search Issue Tracker

Fixed in 5.6.0

Votes

0

Found in

5.6.0a1

Issue ID

845756

Regression

Yes

NullReferenceException when changing font to none

UI

-

To reproduce:
1. Create new project
2. Add Text to scene
3. Change font to none
4. Observe null reference exceptions

NullReferenceException
UnityEngine.TextGenerator.Populate_Internal_cpp (System.String str, UnityEngine.Font font, Color color, Int32 fontSize, Single scaleFactor, Single lineSpacing, FontStyle style, Boolean richText, Boolean resizeTextForBestFit, Int32 resizeTextMinSize, Int32 resizeTextMaxSize, Int32 verticalOverFlow, Int32 horizontalOverflow, Boolean updateBounds, TextAnchor anchor, Single extentsX, Single extentsY, Single pivotX, Single pivotY, Boolean generateOutOfBounds, Boolean alignByGeometry, System.UInt32& error) (at C:/buildslave/unity/build/artifacts/generated/common/modules/TextRendering/TextRenderingBindings.gen.cs:754)
UnityEngine.TextGenerator.Populate_Internal (System.String str, UnityEngine.Font font, Color color, Int32 fontSize, Single scaleFactor, Single lineSpacing, FontStyle style, Boolean richText, Boolean resizeTextForBestFit, Int32 resizeTextMinSize, Int32 resizeTextMaxSize, VerticalWrapMode verticalOverFlow, HorizontalWrapMode horizontalOverflow, Boolean updateBounds, TextAnchor anchor, Vector2 extents, Vector2 pivot, Boolean generateOutOfBounds, Boolean alignByGeometry, UnityEngine.TextGenerationError& error) (at C:/buildslave/unity/build/artifacts/generated/common/modules/TextRendering/TextRenderingBindings.gen.cs:735)
UnityEngine.TextGenerator.PopulateAlways (System.String str, TextGenerationSettings settings) (at C:/buildslave/unity/build/Runtime/TextRendering/Managed/TextGenerator.cs:265)
UnityEngine.TextGenerator.PopulateWithError (System.String str, TextGenerationSettings settings) (at C:/buildslave/unity/build/Runtime/TextRendering/Managed/TextGenerator.cs:249)
UnityEngine.TextGenerator.Populate (System.String str, TextGenerationSettings settings) (at C:/buildslave/unity/build/Runtime/TextRendering/Managed/TextGenerator.cs:240)
UnityEngine.TextGenerator.GetPreferredHeight (System.String str, TextGenerationSettings settings) (at C:/buildslave/unity/build/Runtime/TextRendering/Managed/TextGenerator.cs:220)
UnityEngine.UI.Text.get_preferredHeight () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Text.cs:522)
UnityEditor.Events.LayoutPropertiesPreview.<OnPreviewGUI>m__3 (ILayoutElement e) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEditor.UI/UI/LayoutPropertiesPreview.cs:97)
UnityEngine.UI.LayoutUtility.GetLayoutProperty (UnityEngine.RectTransform rect, System.Func`2 property, Single defaultValue, ILayoutElement& source) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Layout/LayoutUtility.cs:86)
UnityEditor.Events.LayoutPropertiesPreview.OnPreviewGUI (Rect r, UnityEngine.GUIStyle background) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEditor.UI/UI/LayoutPropertiesPreview.cs:97)
UnityEditor.ObjectPreview.OnInteractivePreviewGUI (Rect r, UnityEngine.GUIStyle background) (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:113)
UnityEditor.ObjectPreview.DrawPreview (IPreviewable defaultPreview, Rect previewArea, UnityEngine.Object[] targets) (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:225)
UnityEditor.ObjectPreview.DrawPreview (Rect previewArea) (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:128)
UnityEditor.InspectorWindow.DrawPreviewAndLabels () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:765)
UnityEditor.InspectorWindow.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:392)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

Reproducible: 5.5.0b10, 5.6.0a1
Regression from 5.4.2p2

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.