Game Development Reference
In-Depth Information
Dealing with text
The first control/component we deal with is the Text control. This is used as the
basis for all text drawing for all controls.
You can find the examples shown here in the Scenes\01-Text Control
scene in the bundled sample code.
As you will see, each control is reused by most other controls in a
truly modular approach. This is a nice clean break from the Legacy
GUI in which all controls were concrete implementations.
However, some may not like this approach and may prefer to build
their own UI controls in the old way, as single controls. With the
source now available to all, the choice is up to you.
Whenever and wherever text is displayed in the new UI system, the Text control is
implemented behind the scenes or added as a child component/control to the control
you are adding.
The Unity Text System
At the time of writing, the actual text drawing is still using the legacy
text drawing system; this isn't ideal and can cause graphic artifacts on
the screen when the text is scaled. This is due to be replaced in a later
version of Unity, most likely not until Unity 5,
but it could also be included in the later 4.x series.
If you need a more advanced Text drawing in your project or would
like a few more text effects, then you can check out TextMeshPro on
the Asset Store , http://bit.ly/UnityUITextMeshPro .
Its author, Stephan Bouchard, has been hard at work, updating this
awesome tool to work in hand with the new UI framework, so from
day one, you will be able to implement this in your project with
awesome effects.
Getting started, we can add a Text control to our scene (either create a new scene or
reuse an existing one) by using any of the following approaches:
• From the Menu: GameObject | UI | Text
• From the project Hierarchy : Create | UI | Text
• From the project Hierarchy : Right-click | UI | Text
 
Search WWH ::




Custom Search