Unity – Scripting – GUIText

Unity – Scripting – GUIText (get from gui and code it)

GUI Text

1. MAIN TOP MENU> GameObject> Create Other> GUIText

2. The text will create the GameObject ‘GUI Text’ in the Viewport

3. Project> Assets, select the text> Inspector, setup the text

4. Attach this JS Script at GameObject ‘GUI Text’:

#pragma strict
 
 guiText.text = "Hello Monkey!";         

5. Play and you will see “Hello Monkey!”

Properties List

alignment The alignment of the text. It is object pivot-based
anchor The anchor of the text.
color The color used to render the text.
font The font used for the text.
fontSize The font size to use (for dynamic fonts).
fontStyle The font style to use (for dynamic fonts).
lineSpacing The line spacing multiplier.
material The Material to use for rendering.
pixelOffset The pixel offset of the text.
richText Enable HTML-style tags for Text Formatting Markup.
tabSize The tab width multiplier.
text The text to display.