Join Jesse Freeman for an in-depth discussion in this video Working with text in scripts, part of Unity 5: UI.
- Now we are ready to use code…to control our text field.…In our assets folder…let's create a new folder called Scripts.…And inside of our Scripts folder…let's make a new C# script…called TextTest.…And let's double click this…in order to open it in monodevelop…now in order to work with Unities new UI components…we're going to need to include the name space.…So at the top of our class…let's add using UnityEngine.UI…From here we are going to create two fields.…
One will be our message…and the other will be our text instance.…Our message will be a string,…so we'll make this public.…string message…and the second will be…public Text for our text component…and we'll call this textInstance.…Now let's make the textInstance's text field…match the message value.…Let's save our code,…and go back into Unity.…
We'll select our text field.…And let's remove these two effects.…Now we'll add a component,…and we'll look for our TextTest script.…And let's set a message.…For right now, let's make it Hello World again.…Also, we are going to need a reference…
- 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.