0
\$\begingroup\$

Unity text is very blurry. How can I fix it?

To be honest, I have no idea why it behaves this way:

enter image description here

Hope that someone faced the same problem and will be able to share how it was tackled.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Don't forget to walk us through a Minimal Complete Verifiable Example. What are your Canvas settings? What are your transform settings? How big is your Game window resolution? What settings did you use for your font asset? etc. All of these things can change the number of pixels the text needs to cover, and so affect the resolution generated for the atlas. Also, is there a reason you're not using the Text Mesh Pro UGUI component instead of the legacy Text component? \$\endgroup\$
    – DMGregory
    Commented Apr 14, 2021 at 19:33
  • \$\begingroup\$ As DMGregory noted, it's better to use TextMeshPro these days. It is a little more work to set up and sometimes has weird bugs, but overall is much more powerful. It's a pain to switch from legacy Text to TextMeshPro later, so best to do it early. \$\endgroup\$
    – Kevin
    Commented Apr 14, 2021 at 20:22
  • \$\begingroup\$ @Kevin, thanks. Will try it out. \$\endgroup\$
    – some1 here
    Commented Apr 15, 2021 at 15:50
  • 1
    \$\begingroup\$ The font size seen in the in the video is tiny! It goes from 1 to 3. So it must be getting stretched somehow. \$\endgroup\$ Commented Sep 11, 2022 at 21:11

3 Answers 3

3
\$\begingroup\$

Make certain your UI Text object is not inadvertently upscaled.

This can happen any number of ways. In my experience, the most common occurrence of this happening is due to generating UI objects from prefabs, but it can also happen after you change the reference resolution, reorder/ reparent objects in the hierarchy and probably other situations as well.

Since the OP is using a World Space Canvas (possibly the most prone to scaling issues, as the canvas is rendered as an object in the scene vs. an overlay) I will use that as an example.

New Canvas (including World Space) rect bounds will default to whatever the game view pane is currently set to. Note that if you have your game view set to Free Aspect, that bounds is going to be something fairly arbitrary! For this example, I have set my game view to 2880 x 1920 (blue box).

Simple World Space Canvas Game View with Text Object

As expected, our new Canvas component is scaled to 1,1,1 and is sized to our game view window size by default. I've rotated the canvas 45° in Y to utilize its "world-spaciness" and moved it a bit so it is in view of the default camera.

Inspector for Canvas Component

The text component is also scaled at 1,1,1 so everything looks just fine.

Text Component Inspector

Now this is a fresh scene, created "out of the box" with just these simple components -- it's kind of hard to go wrong in this situation. Suppose instead you are knee deep in scene creation with a complex UI system. You have been moving, resizing and reparenting elements, maybe generating child UI objects from prefabs created with a different scene configuration -- pretty soon you have child objects with (up)scaling applied which is not immediately obvious. For a trivial example, let's say I created the World Canvas and then scaled it up by 10, and then created a text object child. This is the result:

Game View with text

The text object's local scale is still 1,1,1, but it is being upscaled 1000% by its parent canvas. The result is blurry text.

The OP in their answer already pointed out that the Canvas Scaler with its dynamic pixels per unit setting is also key to having Text UI elements properly rendered on screen.

\$\endgroup\$
2
\$\begingroup\$

In order to fix the problem I just went to the game object which contains the Canvas component and added the Canvas Scaler. After that I played around with the Dynamic Pixels Per Unit field value until my text got the sharpness I want.

enter image description here

enter image description here

\$\endgroup\$
1
\$\begingroup\$

Unity ui text is always blurred and have quality issue. You can use TextMeshPro for better quality crisp and sharp text with lots of other options for text customisations.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ This blanket statement is objectively not true: "Unity ui text is always blurred and have quality issue" Properly implemented, Unity UI text works absolutely fine, delivering crisp text. Further, while TextMeshPro can certainly be useful, it adds bloat to your project, and is overkill in many instances. \$\endgroup\$ Commented Sep 6, 2022 at 12:43
  • \$\begingroup\$ Myself, I'd agree with "Use TextMeshPro" as general guidance. It's much easier to get crisp-looking text across a wide range of use cases and resolutions using TextMeshPro, so it would be my first recommendation to someone unsatisfied with the look of text in their game. If you'd like to add an answer, @AcmeNerdGames, detailing steps to configure the built-in UI text to fix blurriness, I think that would also be a valuable addition to this Q&A. \$\endgroup\$
    – DMGregory
    Commented Sep 6, 2022 at 13:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .