Book Image

Creating E-Learning Games with Unity

By : David Horachek
Book Image

Creating E-Learning Games with Unity

By: David Horachek

Overview of this book

Table of Contents (17 chapters)
Creating E-Learning Games with Unity
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Exploring the GUIText component


The easiest way to display text on screen in a camera-relative way is through the GUIText component. To use this component, you need to add an instance of this component to an existing game object in your scene, and set the text field to the string you want to display.

Please keep in mind that the way in which the transform component of the GUIText GameObject is processed for GUIText is different for other GameObjects with the same component, which we will discuss later.

Interpreting the members on GUIText

A (0.5, 0.5, 0.0f) position corresponds to the center of the screen. For this component to work as designed, the object needs to be placed here in the world. The x and y components of the (x, y, z) vector on the transform range from 0.0f to 1.0f each.

Tip

Do not place GUIText on a moving object. If the transform moves, the meaning of the text position will change, and the text will likely go some place you don't want it to! If you want to track a moving object...