BCE0019: 'text' is not a member of UnityEngine.component

My game is Fps based horror game.bt when i imported an asset package ,there is an error showing.in one of my script named FrameCounter is showing the error.It is showing that text is not a member of unityengine.component.

var FPS:int;
function Start () {
    Do();
}
function Do(){
    while(true){
        yield WaitForSeconds(1);
        GetComponent("Text").text = FPS+" : FPS";
        FPS=0;
    }
}
function Update () {
    FPS++;
}

Assuming this script is attached to your text object…

GetComponent<Text>().text = FPS+" : FPS";

Edit: sorry, looks like you are coding in UnityScript… I always assume C#… might be different in UnityScript, but it looks like it should work the same.

You will also probably need to add Using statement at the top for the UI…

using UnityEngine.UI;

The using statement above might be all you need… I don’t use UnityScript, so not sure if it works the way you’re doing your GetComponent, but it probably does, and just needs to know what “Text” is.

Never use strings in GetComponent; that just returns a generic component, but you need to access specific components. GetComponent(Text).text