I want to make a text box that appears when the game is started, containing gameplay instructions, then disappears when the player presses any button. Also, the game needs to not begin until the window has been closed. Here is what I’ve got so far:
I have created a GUIText, with a script attached to it called TextController.cs Here is the script
using UnityEngine;
using System.Collections;
public class TextController : MonoBehaviour
{
public GUIText instructionsText;
// Use this for initialization
void Start ()
{
instructionsText.text = "Your mission: Protect the Interplanetary Space Station." +
"WASD to move, left Control to fire.";
if (Input.GetKeyDown("e"))
{
Destroy(gameObject);
}
}
// Update is called once per frame
void Update () {
}
}
When I play the game, the text is there, but is not destroyed when the E key is pressed. Also, the game plays automatically, as I don’t know how to tell it not to. Note that the E key thing is just a quick solution. I’d like it do be destroyed when there is any input at all. So the questions are : how do I destroy, or otherwise deactivate the text when the player presses a button, and how do I pause the game until the player has closed the window?