- Home /
TextMeshPro text blurry when edited through script
I'm editing a TextMeshProUGUI component's text through a script to display "Tiles" within a GridLayout GUI using:
var label = tileButton.GetComponentInChildren<TextMeshProUGUI>();
label.SetText(tileData.name);
But the three buttons on the right which were added dynamically through this code have blurry text. The tiles are built from the prefab seen on the left, which does not have blurry text (it was not dynamically added. It was placed in the editor).
If I edit the blurry text through the inspector while the game is running, then it'll immediately unblur.
ForceMeshUpdate and SetAllDirty on the TextMeshProUGUI doesn't seem to help, the UI Scale mode is set to Constant Pixel Size, the UI scale is 1x, and the font asset used is an SDF (TMP_Font Asset).
Any other way I can unblur this text?
Answer by Masterben135 · Jan 31 at 02:05 PM
Found an answer here: https://forum.unity.com/threads/some-characters-appear-blurry-when-text-generated-at-runtime.966248/
Swapping the default shader "Distance Field" with the newer shader "Distance Field SSD" on the Font asset's material fixed the blurriness.
Your answer
Follow this Question
Related Questions
Simple text GUI 2 Answers
Drawing UI text on GUI.DrawTexture , How to do it ? 1 Answer
Fade logo before main menu 2 Answers