- Home /
How can I set TextMesh's font size to pixel size?
I will use TextMesh to render GUIs. (and support unicode characters.) and I cannot use GUIText or GUI.Label in some reason.
I have orthographic camera for GUI, and size is always half of screen height. It perfectly matchs world position 1 to pixel position 1.
I make TextMesh GameObject which font size is 32, and character size 1. but It looks very small in game play screen. I want to 32 size font renders perfectly 32 pixel size. How can I?
Or Is there some formular to create polygons in TextMesh?
Or I hope freetype lib ported in c#.. (not dll, because of web publishing)
Answer by dissidently · Dec 29, 2010 at 01:17 PM
Change the scale of your textmesh. This way you can make it smaller or larger as you require. I'm running mine at 0.05 scale, going the other way, making very large font textures smaller so that they're perfectly aliased when close to the camera. You'll need to go the other way, making the scale larger.
Answer by Ludeme Games · Oct 11, 2013 at 08:39 AM
You need to set both character size and text size. If font size is the world unit desired size, set character size to 10. See here - http://answers.unity3d.com/questions/55433/textmesh-charactersize-vs-fontsize.html
Answer by tonic · Feb 24, 2014 at 01:43 PM
You could try using my Pixel-Perfect Dynamic Text asset which is an alternative for TextMesh.
For Pixel-Perfect Dynamic Text you set text size in world units, and it will automatically figure out the closest actual pixel size for your current camera and dpi and screen resolution.
Answer by GoldenProlix · Apr 24, 2016 at 02:38 AM
(For the new UI system) On the object go to Text (Script) >> Paragraph >> Best Fit, check that box (and make sure Font Size is not 0). Then change the scale of that to the desired size. This will also make sure the text stays clear unlike simply changing the scale.
Your answer

Follow this Question
Related Questions
Font Metrics 1 Answer
Sphere and text mesh in prefab share transformation matrix 0 Answers
How to set player name on object in multiplayer? 0 Answers
Multiple issues with the TextMesh component 0 Answers
Text Mesh to Mesh ? 2 Answers