How to drap text to the script

[SOLVED]. I don’t know how to add the text to the script. It don’t show the text box. The snapshot is given bellow.

Code:

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class TextController : MonoBehaviour {
public Text text;
// Use this for initialization
void Start () {
Text.text = “Hello World”;

}

// Update is called once per frame
void Update () {

}

}

Text.text = "Hello World";
should be
text.text = "Hello World";

The reason is because you are declaring public Text text; so the object you are wanting to work with is the lower case version.

1 Like

Thank you.

Privacy & Terms