GUIText Script Error Help Me Pls

using UnityEngine;
using System.Collections;

public class Score : MonoBehaviour {

static int score = 0;
static int highScore = 0;

static public void AddPoint()
{
    score++;

    if (score > highScore)
    {
        highScore = score;
    }
}

void Update () {
    guiText.text = "Score: " + score + "

Hign Score: " + highScore;
}
}

void Update () {
    guiText.text = "Score: " + score + "

Hign Score: " + highScore;
}
}

guiText.“text” Error The “text”

Error 1 ‘UnityEngine.Component’ does not contain a definition for ‘text’ and no extension method ‘text’ accepting a first argument of type ‘UnityEngine.Component’ could be found (are you missing a using directive or an assembly reference?)

Please :smiley:

The main problem is that you need to add using UnityEngine.UI namespace at the top. Only then you can access the UI components.

The second thing is, I don’t see where you are declaring the guiText object, so I’d suggest making a public Text variable at the top and dragging the text UI object from the scene there.