Gui Text Script

Hi,

I'm doing the challenge 3 on http://www.unity3dstudent.com/2010/07/challenge-c03-beginner/ and I can't get the GUI Text to work. I what the GUI Text to go up by one number every time the ball collides with the box/target, and when you get 3 point go to the win screen. What script (Javascript) do I need for that. Thanks,

Mr.Snake

How I done it..

Created a script named score.js with the following code:

static var Score : int = 0;

function Update () {
    this.text = "Score:" + Score.ToString();
    if(Score == 3) {
        Application.LoadLevel("youwin")
    }
}

I attached this script to the GUItext object that displayed the score.

Then in the script that catches collision with the box I put

score.Score += 1;

Hope this helps ;)

Hi Mr Snake When I next get on my dev computer I'll comment the code and send you the project ;) PS. Don't forget to vote me up :)

Hi,

As promised I've emailed you the complete project. Sent to email found through the website link found on your profile ;)

Hi Mr Snake When I next get on my dev computer I'll comment the code and send you the project ;) PS. Don't forget to vote me up :)