The first traditional problem to be solved with a new computing technology is often to display the Hello World message. In this recipe, you'll learn to create a simple UI Text object with this message, in large white text with a selected font, and in the center of the screen.
For this recipe, we have prepared the font that you need in a folder named Fonts
in the 1362_01_01
folder.
To display a Hello World text message, follow these steps:
Fonts
folder.Hello World
Xolonium-Bold
50
or 100
)Overflow
The following screenshot shows the Inspector panel with these settings:
You have added a new Text-hello GameObject to a scene. A parent Canvas and UI EventSystem will also have been automatically created.
You set the text content and presentation properties, and use the Rect Transform anchor presets to ensure that whatever way the screen is resized, the text will stay horizontally and vertically centered.
Here are some more details that you don't want to miss.
Each separate UI Text component can have its own color, size, boldness styling, and so on. However, if you wish to quickly add some highlighting style to a part of a string to be displayed to the user, the following are examples of some of the HTML-style markups that are available without the need to create separate UI Text objects:
b
" markup: I am <b>bold</b>
i
" markup: I am <i>italic</i>
I am <color=green>green text</color>, but I am <color=#FF0000>red</color>
Learn more from the Unity online manual Rich Text page at: http://docs.unity3d.com/Manual/StyledText.html.
3.139.83.62