Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Unity v1.2.2 tutorial, page 17

Discussion in 'Editor & General Support' started by Pavlov, Jun 6, 2006.

  1. Pavlov

    Pavlov

    Joined:
    Jun 7, 2005
    Posts:
    41
    I've created the 'Enemy script.js' as shown below and attached it to both of the enemies.

    var score : Score;

    function Update () {

    if (transform.position.y < -2) {

    Destroy (gameObject);
    score.AddToScore ();
    }
    }

    I've created the 'score.js' script as shown below and attached it to the GUIText object Score (which is actually a text object shown in the GameObject menu).

    var score = 0;

    function AddToScore () {

    ++score;
    guiText.text = "Score: " + score.ToString ();
    }

    It keeps complaining about 'Assets/Working Assets/Scripts/enemy script.js(1) error BCE0018: The name 'Score' does not denote a valid type.' Stupid question, what am I missing?
     
  2. Pavlov

    Pavlov

    Joined:
    Jun 7, 2005
    Posts:
    41
    got some help from the irc, the name of the script file wasn't uppercased. I need to follow Unities coding standard.