In this video Jesse Freeman teaches you how to add text to the message window. You’ll start by getting a reference to Unity 5’s UI Text component and setting it up inside of the window. Then expose the Text component through a custom getter on the window class making it easy to pass new string values to it.
- [Voiceover] Now that we're able to show…our message window,…it's time for us to display text.…Let's go ahead and open up the message window class.…At the top of our class,…we're gonna need to bring in…the Unity UI Namespace.…Once we have access to those classes,…we can make a reference to the text instance…that's inside of our message window game object.…Let's create a private field, typed to text,…called textInstance.…Next, we're gonna create a public property…so that we can set the text.…
Let's make this public.…Its type will be string,…and we'll name it text.…Inside of it, we'll add a setter,…and we'll set the text instance's text field…to equal the value being passed into our setter.…Now let's go ahead and override the Awake method.…Before we call base.Awake,…let's set the value of textInstance…to equal GetComponentInChildren,…and we'll pass in the text class.…
Since we only have one game object…inside of our message window,…and that game object has a text class,…this should work fine.…Now let's go ahead and save this…
- Preparing the user interface
- Creating game and message windows
- Building a battle window
- Adding a monster and action buttons
- Creating an actor class
- Adding player and monster attack actions
- Triggering battles from the map
- Ending a battle
- Cleaning up the battle and attack systems
- Rewarding the player
Skill Level Intermediate
1. Preparing the UI
2. Message Window
3. The Battle Window
4. Actor Classes
5. Battle Actions
6. Cleaning Up Combat
- 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.