Created
December 13, 2015 14:21
-
-
Save tinyhappysteps/e8ea3d3ef0a7d40cd767 to your computer and use it in GitHub Desktop.
Text UI in Unity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using UnityEngine.UI; // brings in UI information | |
public class TextController : MonoBehaviour { | |
public Text text; // requires UnityEngine.UI, publicly exposes the text | |
// Use this for initialization | |
void Start () { | |
text.text = "Hello World"; | |
} | |
// Update is called once per frame | |
void Update () { | |
if (Input.GetKeyDown (KeyCode.Space)){ | |
text.text = "Space key pressed"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment