- Home /
What is the best text tool for dynamically displaying pixel-perfect text for a unity game on multiple devices?
I'm looking for a text solution that meets the following criteria, and I was wondering how the different text tools out there measure up:
dynamically displaying text
pixel-perfect
resolution-independent (will look good on multiple devices, different generation iPhones and iPads)
automatic text-wrapping
relatively straightforward to use
a plus if the solution includes text input fields, but not a priority
I know of Catlike Coding's Text Box, ex2D, 2D Toolkit, and EZGUI. How do these compare in terms of the criteria that I listed above. Is there one that covers most or all? What are the pros and cons of each of these text systems?
Answer by robertbu · Jan 22, 2013 at 08:59 PM
I can only comment on EZGUI. EZGUI can do all of the above, though there is a some work if you want pixel-perfect to be a similar viewport size on multiple devices. I found a significant learning curve in dealing with EZGUI as a whole, but the text portion (The SpriteText class) is fairly easy. They provide a video tutorial for making text.
SpriteText uses a single atlas of characters in the form of a texture and a font file that maps into the texture. At runtime, SpriteText builds a mesh (one rectangle per character) and sets the UV coordinates to point into the texture. If you change the text at runtime, SpiteText rebuilds the mesh.
As for authoring the bitmap atlas, there are three tools I know of (EZGUI does not provide one): Hero - a free cross platform tool; BMFont - a free windows tool; and GlyphDesigner - a commerical Mac tool.
As for managing devides with multiple resolutions, there are a couple of choices. You can author for some primary device and make the font pixel perfect on that device and let the font be resized on other devices, or you can detect the device and swap out the texture/material and font mapping file per device. There is no native support for this swapping, but it is just a matter of reasigning the material and a TextAsset. The quality drop from resizing was minimal to my untrained eye when resizing down.
Each SpriteText, is assigned to a specific texture, so within a SpriteText, only a single font size/face can be used. There is the ability to specify certain sections of the text assigned to a SpriteText object to be overlaid with a color.
I found the quality of output to be a bit below that of a native font on the iPad. Given it is a bitmap font, I expected it. Performance was very good. I ran a test turning all the paragraphs of a book into SpriteText objects and attaching them to a slider to create a scrollable book. Layout time on the desktop was aproximately .25s and about twice that on the iPad 3. Here is a screen shot from the inspector showing all the available settings for a SpriteText:
Answer by tonic · Aug 26, 2014 at 12:29 PM
Hi, I'd like to mention my solution which fits most of your criteria: Pixel-Perfect Dynamic Text
It is meant to be a replacement for the built-in Text Mesh so it works in world coordinates, but it makes it possible to have just as crisp text as the built-in GUI Text. Internally it uses the same dynamic Font system than what Unity uses.
As of writing of this, there's no support for word-wrapping or text input fields. But it should be a very good fit for the other parts of your wish-list.
Your answer
![](https://koobas.hobune.stream/wayback/20220613075532im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
GUIText Help 1 Answer
Changing the font of a tk2dTextMesh in C# 0 Answers
2D array problem in C# 2 Answers
How do I scale GUI Text but while keeping it "pixel correct"? 3 Answers
Change textAsset.text 1 Answer