For a Unity 2D WEB GL game I'm working on I've imported and used a font which isn't one of Unity's default fonts. I use this font for the text which gets displayed on a canvas. Since my text uses some characters which aren't in the font file, I've set the font character option to dynamic. The result is that the special characters get displayed properly but the text looks quite blurry and not at all sharp.
Now what I want is the text to look sharp, but I've tried pretty much everything I could find with no success. The objects which display the text use a Text Component. I've also tried switching to a TextMeshPro Text Component and generating the font atlas and everything but again to no success.
I've also tried to set the font character type to unicode instead to see what it does (eventhough I know it will not work with my special characters). The result was quite sharper but perhaps too sharp. If I play the game not on full screen mode, some letters are so pixely/crispy they just aren't readable. Thus that wasn't an option either.
I'm at my wits end for this one. Any and all help is greatly appreciated!
Here's an image example of the blurry font:
I had the same issue with a font using textmesh pro.
Disabled the HDR of the camera component and then it was much better.
A simple solution to this problem is to play with Unity CanvasScaler component.
This is usually attached to your UI Canvas.
https://docs.unity3d.com/Manual/script-CanvasScaler.html
You can tweak the values here to get the best result.
You should increase 'Dynamic Pixels per Unit' on Canvas Scaler
Related
The post is a bit long but I tried to explain everything that is connected to the issue.
This screenshot is of the parent ui texts canvas.
This is a screenshot of the description ui text the text in the game looks very big the fonts are very big and stretched.
This is a screenshot of the scene text Image settings :
And the scene ui text settings :
This is a screenshot of the scene ui text when running the game from the exe build file :
And last the description ui text in game when running the build exe file :
How can I make some ui text that will be display the text the same in all the cases something that will be readable nice not too small and not too big ?
In the scene text the text is smaller because I wanted the text to be a bit under the player mouth. In the description text is a bit bigger but then everything get messed.
I think I want the text to be shown like in the scene ui text in all the places. I think the size is fine. but not sure how to do it.
There's a couple of things here that should get your text working nicely across the board.
Firstly, at your root Canvas object, you'll usually have a Canvas Scaler there. The default of "Constant Pixel Size" is often exactly what you don't want. I normally have it set to "Scale With Screen Size", and then set the resolution to 1920x1080. I do that because 1920x1080 (16:9) is the standard Full HD screen size, so you can bet that most of your screen layout is going to look the same across most displays.
The second suggestion would be to use TextMeshPro. If you haven't already got it installed through your Package Manager, then you can find it there. Here's the docs for that. It's FAR superior to the standard Text element and you'll notice less issues trying to get your text looking correct. It's usually just a matter of adding the TMPro_Text UI component to the same object your Text component was originally on (removing the original Text component of course).
I would also leave all scaling for all of your UI items set to (1, 1, 1) where you can and let and scaling be done by the Canvas Scaler. The text elements can certainly be left at (1, 1, 1) and just change the font size.
Once you get these three things sorted, your text should be the same across all of your pages, and devices.
This due to Scaling Rect Transform Component
to solve this don't scale up or scale down UI Elements {Image ,Text, ... just keep Scale 1,1,1 }
First I recommend You to see This to understand this Component
https://www.youtube.com/watch?v=FeheZqu85WI&t=6s
Now to Solve your problem
Set Scale of Description Image (1,1,1)
Set Scale of Description Text (1,1,1)
Do 1,2 with Scene Image, Scene Text
Change Width , Height of{Description Text, Scene Text} with small values 900*400
I am experiencing the issue with text colour not changing to what I set in the inspector resulting in always black text.
I have followed the advise to create a material and assign that to the font and this appears to work, but only on a static text field or button text.
I have a text field in a scrollview and after I apply the material the scrollview mask no longer hides the text outside of the scroll area?
If I set the material shader to GUI/TextShader I get the correct colour, but the srollview mask does not work, if I set it to no material the mask works but colour is black?
This happens on every font as soon as I add a material?
I have tried all manner of shader setting without any joy, does anyone know how to resolve this? It seems totally bonkers to me :-(
SORTED!
I imported TextMesh Pro, used its Font Creation Tool and hey presto :-)
Not sure why the default Unity text component cant handle this?
Unity Version: 5.6.5f1 Personal
TextMesh Pro Version: 1.0.56.0b3
I have a TextMesh Pro UI Text object whose area intersects the area of a UI Image. The text is dynamic, but the image will never change. Is there a way to make the TextMesh Pro UI Text flow around the image similar to how text would wrap to one side in HTML/CSS?
The image below shows two copies of the object in Unity. One object, denoted by a red space where the image is located, is what I'm currently getting. The text enters the space of the image. The other object, denoted by a blue space where the image is located, shows the desired outcome where text is wrapping properly.
Current vs. Desired Outcome:
Research so far:
How do I put an image inside text? - The Image that I'm using is a UI Image, not a text asset. The Image will only act as though it is inline with the text.
How do you wrap text around a rectangle?, Fluid layout for Unity UI - These are what I'm looking for. However, no suggestions have been posted in them.
I've explored the idea of using multiple TextMesh Pro UI Text Objects, with each one acting as a fragment of the complete text area. However, this isn't the same as wrapping the text around the Image. For dynamic text, if I pull content from one text area and push it into the next area, this will conflict with the Auto-Sizing functionality and cause unequal font sizes.
Another possibility is that I could insert characters one at a time, check to see if adding another character would result in a collision with the image, and add System.Environment.Newline to prevent this. However, I worry about the potential performance issues from dealing with large amounts of text.
TextMesh Pro Documentation - The TextMesh Pro Documentation has some tools for finding word wrap points, but I haven't figured out how to implement a means of comparing this to an anchor position of another object.
This can be accomplished with TextMeshPro's "Linked" overflow mode. See attached picture for an example. Essentially, you'll need to make two TMP objects and adjust the layout for each of them appropriately. Then:
1) change the overflow mode of the first one to "Linked" using the dropdown in the inspector.
2) place the second TMP object as the reference in the field that appears.
I've read that Unity has problems rendering clear text and I've tried out several different fixes: setting a large font size on the imported font and changing the character setting to unicode, making the text size large and then scaling it down, setting filter mode to point when it comes to pixel fonts... All these methods seem to work from the editor (as in, the text appears crisp), but in the game the text is still blurry:
vs.
(The screenshot is using free aspect - the text looks better, but still somewhat blurry, when the game view resolution matches the reference resolution.)
Currently, the imported font (not pixel) is set to a size of 180; rendering to smooth; character to unicode. The text isn't scaled right now and is at a size of 50. The canvas is set to scale with screen size, and the reference resolution is 2560x1440 (a Samsung S7). It should also be noted that at a different resolution, the box around the text (which is an image) also gets blurry, which makes me think it's a problem with the canvas scaling.
What am I missing?
Turns out all I had to do was uncheck Low Resolution Aspect Ratios in the game view... The text is still slightly blurry, but likely that's typical of Unity. To counter that, I just decided to use a pixel font (using the fix explained in this video).
I use scaling down as a workaround.
For me, it was using Unity-Remote. After building the app directly I didn't see the blur anymore.
I had the same problem, the best solution to the blurry text problem in Unity is as follows:
Select the text item from the scene.
Go to Font and see where your font is located in your project folder
Go to your font in your project
Change the font size from 16 to 100-300
change "Character" to "Unicode"
Press Apply
I am porting a game from the iPad to iPhone (using XCode cocos+box). I use a custom font (*.ttf) which is nice when drawn with a big font size, but if I use a small font size, the text gets too blurry.
If I do not scale font size itself but scale the font's parent, the text becomes too sharp-cut and memory consuming. Since I'm porting a game, I need font to be a bit blurry, but not too much so that it is still readable.
There is also another problem with the blurriness: not all text looks nice. I create a "Start game" label and it looks just fine but when I create a "Settings" label just the same way it looks more blurry.
Is it because of the *.ttf file or is it me doing something wrong? If it is the font, how can I fix it?
Text and images look blurry if they are drawn at half pixel boundaries, can you provide us with the source code that is responsible for drawing the text into the screen?