Learn how to populate a stats window to show player data during the game as they navigate the tilemap and during combat. You’ll learn how to access Unity 5’s new UI Text component, change the text it displays and create an update method that can be called anywhere from the game.
- [Voiceover] Now, in order for us to display the stats…we're gonna need to create a new window.…Let's go into our advanced UI, scripts, windows folder.…Right click and create a new C-sharp script,…and call it stats window.…Then let's open it up in mono develop.…For this window, we're gonna need to work…with the Unity UI components.…So, let's import their namespace by typing using,…UnityEngine.UI.…We're also gonna be working with text,…so let's import system text namespace as well.…
Let's have our stats window extend our generic window class,…and we'll delete our start and update methods.…At the top of our stats window, we're gonna create…a new public field with the type Actor, called target.…And we're also gonna create another public field…with the type Text, called valueLabel.…Then, we're gonna need to create a method…in order to update the stats.…Let's make this public, with a return type of void,…and call it UpdateStats.…
And inside of it, we're going to add a guard clause.…First we're gonna test to see if the target equals null…
- 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?
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.