Book Image

OUYA Game Development by Example

By : John Donovan
Book Image

OUYA Game Development by Example

By: John Donovan

Overview of this book

The OUYA console and development kit gives you the power to publish video games for the players, creating a console marketplace of the gamers, for the gamers, and by the gamers. Using the OUYA developer kit and the Unity3D game engine, even beginners with a captivating game idea can bring it to life with a hint of imagination. OUYA Game Development by Example uses a series of feature-based, step-by-step tutorials that teach beginners how to integrate essential elements into a game engine and then combine them to form a polished gaming experience.
Table of Contents (18 chapters)
OUYA Game Development by Example Beginner's Guide
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – displaying high score values


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:

  1. Attach your HighScoreText script to your GUI Text object by clicking-and-dragging it over the GUI Text object in the Hierarchy window.

  2. 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...