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 have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Error in Unity Tutorial Space Shooter

Discussion in 'Scripting' started by Dev_23, Oct 9, 2014.

  1. Dev_23

    Dev_23

    Joined:
    Oct 4, 2014
    Posts:
    18
    Hello;

    I'm in the section Counting points and displaying score, and one of the functions he tells us to use is UpdateScore(). After I save the script, I get this error:
    Assets/Scripts/GameController.cs(20,17): error CS0103: The name `UpdateScore' does not exist in the current context

    My code:
    Code (CSharp):
    1. public GUIText scoreText;
    2.     private int score;
    3.     void Start() {
    4.         score = 0;
    5.         UpdateScore ();
    6.         StartCoroutine (SpawnWaves ());
    7.     }
    Is this an error in how I typed it, or what?

    Thank you for you time,
    Dev_23
     
    Last edited: Oct 10, 2014
  2. anonymousunitycreator

    anonymousunitycreator

    Joined:
    Sep 20, 2014
    Posts:
    43
    Have you actually defined the UpdateScore(); function somewhere in the same script?

    you should have a
    Code (CSharp):
    1. void UpdateScore()
    2. {
    3.      //code here
    4. }
     
  3. Dev_23

    Dev_23

    Joined:
    Oct 4, 2014
    Posts:
    18
    Found the issue. Didn't capitalize "u" when I defined the function. Thank you!