How do I Script GUI Text Objects?

I have a text box created via "Game Object > Create Other > GUI Text. I would like to have a script control the Text info of this object, but I do not know how I would code it to target the Text box. I have a script called “Script_SceneManager” that I would like to use to hold the code, but not sure how to structure it to target my GUI Text.

If you have a reference to the GUIText object, you can use guiText.name to change the text in the field.

The simplest way to do this is to make a public variable in your script, and assign it in the inspector by dragging and dropping.

public GUIText myGUIText;

public string newText;

void Update()
{
    if(Input.GetKeyDown(KeyCode.C))
    {
        myGUIText.text = newText;
    }
}