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 CS1525: Unexpected symbol `}' HELP!!!

Discussion in 'Scripting' started by SeanOMik, Nov 13, 2015.

  1. SeanOMik

    SeanOMik

    Joined:
    Nov 8, 2015
    Posts:
    21
    Assets/Custom Scripts/Swimming V2.cs(22,9): error CS1525: Unexpected symbol `}' i cant fix this error no matter how much i try. I try to put a ';' after line 22 and it says that that ';' is unexpected.

    Code



    Please help i have been spending hours trying to fix this..
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Yup. This code makes no sense.

    Code (CSharp):
    1.         bool IsUnderwater()
    2.         {
    3.                 return gameObject.transform.position.y <24.7>
    4.         }
    Did you perhaps intend this

    Code (CSharp):
    1.         bool IsUnderwater()
    2.         {
    3.                 return (gameObject.transform.position.y  < 24.7f);
    4.         }
     
    SeanOMik likes this.
  3. SeanOMik

    SeanOMik

    Joined:
    Nov 8, 2015
    Posts:
    21
    OMG xD thanks sooooooo much boredmormon!
     
  4. SeanOMik

    SeanOMik

    Joined:
    Nov 8, 2015
    Posts:
    21
    Well now i get all of these errors... (Im a Begineer btw...) Capture.PNG
     
  5. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,066
    If you read the errors, 9 out of 10 times they tell you exactly what you need to fix :)
     
  6. Fersutagames_

    Fersutagames_

    Joined:
    May 2, 2013
    Posts:
    52
    Are you using an asset kit?
     
  7. SeanOMik

    SeanOMik

    Joined:
    Nov 8, 2015
    Posts:
    21
    Ya, I know but how do i fix that?


    [EDIT]
    Like how to fix it? (Im a beginner
     
  8. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    That's normal. Each error you fix lets the compiler discover others.
     
  9. SeanOMik

    SeanOMik

    Joined:
    Nov 8, 2015
    Posts:
    21
    No im not i made a folder named custom scripts and put my scripts in that folder
     
  10. SeanOMik

    SeanOMik

    Joined:
    Nov 8, 2015
    Posts:
    21
    How do i fix it then?
     
  11. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    This

    Code (CSharp):
    1.                 cc = gameObject.GetComponent<CharacterController>;
    should be this throughout the code

    Code (CSharp):
    1.                 cc = gameObject.GetComponent<CharacterController>();
     
  12. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    As a general tip you should always focus on the first compiler error. The others are often nonsense because the compiler got confused after the first one.
     
  13. SeanOMik

    SeanOMik

    Joined:
    Nov 8, 2015
    Posts:
    21
    What do you mean my throughout the code, change anything that has CharacterController to CharacterController()
     
  14. SeanOMik

    SeanOMik

    Joined:
    Nov 8, 2015
    Posts:
    21
    Ah ok well now i got this error on the first,
    error CS1061: Type `FirstPersonController' does not contain a definition for `jumping' and no extension method `jumping' of type `FirstPersonController' could be found (are you missing a using directive or an assembly reference?)
     
  15. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    No. Anything that has GetComponent<something> should be changed to GetComponent<something>()
     
  16. SeanOMik

    SeanOMik

    Joined:
    Nov 8, 2015
    Posts:
    21
    Ah ok
     
  17. SeanOMik

    SeanOMik

    Joined:
    Nov 8, 2015
    Posts:
    21
    OK well i did that and This is the first error:
    error CS1061: Type `FirstPersonController' does not contain a definition for `jumping' and no extension method `jumping' of type `FirstPersonController' could be found (are you missing a using directive or an assembly reference?)