something about the UI element "Text"

hi everyone ,i want to ask a question about how to change the text my Text UI element will display by scripting,i just write a simple script attched to a Text UI element:

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

public class MyScoreText : MonoBehaviour {
    public GameObject player;
    private PlayerStuff playerStuff;
    void Start(){
        playerStuff = player.GetComponent<PlayerStuff>();
    }
    void Update(){
        gameObject.guiText.text = playerStuff.Score.ToString ();
    }

}

but i was told that there is no “GUIText” attached to my gameobject(Text UI element).
At firsti think i should use like “gameObject.text = playerStuff.Score.ToString ()”,but text doesn appear as one of the variables of gameObject.
coule anyone tell me how to change the text by scripting ?
My Text UI element was created by “GameObject->UI ->Text”

There is no GUIText component involved with the new UI. That’s the very old obsolete GUI system; forget it exists. Use GetComponent with the Text component instead.

–Eric

In other words

GetComponent<Text>().text = "Hello World";

thanks~ actually i tried this way before,but i forgot to add using Unity.Engine.UI statement:smile::smile:.