Search Issue Tracker

Fixed in 1.5.0-preview.6, 2.1.0-preview.6, 3.0.0-preview.6

Votes

1

Found in [Package]

3.0.0-preview.4

Issue ID

1216007

Regression

No

TextMesh Pro renders text as grey squares in build after altering the text field and modifying object's transform local scale

Package: TextMeshPro

-

How to reproduce:
1. Open attached project (TextMeshPro_Bug_Example_Project.zip)
2. Build and run the project (Shortcut: Ctrl + B)

Expected result: There is text on the screen saying "Hello World"
Actual result: There are grey squares in places where text characters should be

Reproducible with: 2017.4.37f1 (1.2.2), 2018.4.17f1 (1.2.2), 2019.2.21f1 (2.1.0-preview.4), 2019.3.1f1 (2.1.0-preview.4), 2020.1.0a22 (3.0.0-preview.4)

Notes:
1. Sometimes downgrading the package causes the text not to render at all, requiring the deletion of the TextMesh Pro essentials folder(if it exists), text mesh UI object deletion and recreation (with attached TextBugTest.cs script) and/or a project restart
2. The text renders as squares if these conditions are met:
1. The TextMeshPro components "text" field is empty
2. On the first frame of Update:
a. The TextMeshPro components text field is set using the SetText function with a StringBuilder as an argument
b. The transform.localScale of the text GameObject is set to 0 on the y-axis
3. On the second frame of Update:
a. The transform.localScale of the text GameObject is set to 1 on the y-axis
3. Tested on a Windows PC and Mac
4. If on the second frame the scale of the text GameObject is set to any other value not equal to 1 the bug does not reproduce

  1. Resolution Note (fix version 1.5.0-preview.6, 2.1.0-preview.6, 3.0.0-preview.6):

    In order for text to render correctly using Signed Distance Field (SDF), scaling information (SDF Scale) must be passed to the shader. In addition, the scale of the text object must be uniform for x, y, z.

    If the scale passed to the shader is incorrect, the text will either appear fuzzy or overly sharp.

    In the event of a scale of 0 which is what happens when the X or Y scale component of the text object is zero, the text will render as grey blocks of texts.

    The text rendering as grey block when the scale of the X or Y component is zero is expect behavior and not a bug.

    However, in this particular case, when the Y scale of the text component is set to 1, the text should render correctly on that same frame which was not the case here and as such a bug.

    This current issue was related to the Canvas System updating its canvases before the text component (in onPreCull) on the same frame updates the text. The fix was to have the text components update themselves prior to the Canvas system using the willRenderCanvases event instead of onPreCull.

    Package fixed in versions: 1.5.0-preview.6, 2.1.0-preview.6, 3.0.0-preview.6

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.