-
Book Overview & Buying
-
Table Of Contents
OUYA Game Development by Example
By :
We haven't done anything complicated with GUI Text objects, but they can be powerful and versatile with the proper formatting, so now we'll go over a few tricks you can use to cleanly display three different scores in a list format using only one GUI Text object. Perform the following steps to display high score values:
Attach your HighScoreText script to your GUI Text object by clicking-and-dragging it over the GUI Text object in the Hierarchy window.
Create a new function called DisplayHighScores in the HighScoreText script as shown:
void DisplayHighScores()
{
}By default, a GUI Text object displays information in a straight line of text, but what we want is something similar to a list. To achieve this, we'll use what's called an escape character or a special character in the middle of a string that dictates how it's processed or displayed. In this case, we'll be using \n, which creates a new line whenever it's called. While escape characters...
Change the font size
Change margin width
Change background colour