Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question I can't find what is wrong with script.

Discussion in 'Getting Started' started by TITUXS, Apr 20, 2024.

  1. TITUXS

    TITUXS

    Joined:
    Apr 20, 2024
    Posts:
    1
    It just says error CS1002, and that I am missing ; at line 52. upload_2024-4-20_21-13-0.png
     

    Attached Files:

  2. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 5, 2024
    Posts:
    574
    Ryiah likes this.
  3. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,988
    You are missing an if in line 52. Also, yeah, please use code tags and post in the correct sections.
     
    Ryiah and bugfinders like this.
  4. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,738
    Line 38 is incorrect too. Avoid extraneous parentheses. It can very quickly lead to mistakes.
    Code (csharp):
    1. if(Input.GetKeyDown((KeyCode.Space) && isOnGround))
    Here's the corrected line.
    Code (csharp):
    1. if(Input.GetKeyDown(KeyCode.Space) && isOnGround)
    If you're using a proper IDE these mistakes will be highlighted with red squiggly lines.

    upload_2024-4-20_15-29-58.png