Join Jesse Freeman for an in-depth discussion in this video Creating text, part of Unity 5: UI.
- Now it's time to take a look at the text component. Let's create a new scene and save it into our scenes folder, and we'll call it TextScene. Now, let's create a new text field. We'll go into the UI menu and select Text. As you can see, just like all the other components, our text field is going to get a rect transform, a canvas render, but now we're going to have a text component. Before we start changing these values, let's go into the canvas and change the scale mode to scale with screen.
Now, let's go back to our text field and reset the rect transform positions. Now we have our text and it's centered in the screen, but it's going to be really hard to read. Let's change the size to 30, and inside of it let's write "hello world." You can also change the color to white in order to make it easier for us to see. You'll notice that the text automatically wraps.
If we were to go back into our rect transform and change the width to 100, you'll see that we now get the text to render on one complete line. You can also change the alignment to be centered, left aligned, or in the middle, or bottom of the boundaries we've defined as the text component. All of this is dependent on the width and height of our component in the rect transform. In the next video we'll talk about overflow and how that affects the text that's rendered inside of our text field.
- Adding new components to the Canvas
- Working with RectTransforms
- Nesting UI elements
- Adding rich text and effects to the UI
- Creating images
- Styling UI buttons
- Handling input
- Creating sliders
- Controlling the layout of the screen
- Adding toggles and dropdowns
Skill Level Intermediate
1. The Canvas
2. Working with the RectTransform
3. Working with Text
4. Working with Images
5. Working with Buttons
6. Handling UI Input
7. Working with a Slider
8. Controlling Layout
9. Toggles, Dropdowns, and the Input Field
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.