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. Dismiss Notice

Checkpoint Error

Discussion in 'Scripting' started by u_wot_m9, Mar 10, 2016.

  1. u_wot_m9

    u_wot_m9

    Joined:
    Mar 8, 2016
    Posts:
    3
    So i'm new to unity, and i couldn't finish the script as i got an error saying Unknown identifier: CheckPoint

    Here's my script:

    #pragma strict

    var maxFallDistance= -10;
    var isRestarting = false;

    var GameOverSound : AudioClip;

    function Update ()
    {
    if(transform.position.y <=maxFallDistance)
    {
    if (isRestarting == false)
    RestartLevel();
    }

    }


    function RestartLevel (){
    isRestarting = true;
    GetComponent.<AudioSource>().clip = GameOverSound;
    GetComponent.<AudioSource>().Play();
    yield WaitForSeconds (GetComponent.<AudioSource>().clip.length);
    //Application.LoadLevel("Level01");
    transform.position = CheckPoint.ReachedPoint;
    }
     
  2. Suddoha

    Suddoha

    Joined:
    Nov 9, 2013
    Posts:
    2,824
    The error tells you the issue: It doesn't know the identifier CheckPoint, which means in your case, that there is no script (or class in general) with the exact name "CheckPoint". Make sure everything is named correctly, it's case sensitive.
     
  3. u_wot_m9

    u_wot_m9

    Joined:
    Mar 8, 2016
    Posts:
    3
    Thank you, I didn't know that. :)