Search Unity

Question Whats Wrong with my code?

Discussion in 'Getting Started' started by Floffle, Aug 21, 2023.

  1. Floffle

    Floffle

    Joined:
    Feb 9, 2023
    Posts:
    2
    I have an error stating there is a semicolon expected (error CS1002: ; expected) but I don't see where I would need one. I was using an older Brackeys tutorial from 6 years ago about making a smooth camera. his code doesn't have any differences from my code, I'm not sure if the code is just out of date since Im new to Unity and coding in general. compared to other code I've written it doesn't look like it would have any issues, so Im not sure.
    upload_2023-8-20_23-57-14.png
     
  2. BABIA_GameStudio

    BABIA_GameStudio

    Joined:
    Mar 31, 2020
    Posts:
    497
    I'm sorry, but I doubt that - otherwise he would have exactly the same error you do.

    That last line in your LateUpdate method is definitely incorrect.

    I would recommend going back to the tutorial and confirming what that line should actually be, as it is definitely not right at the moment. I'm going to guess it is supposed to just be:
    transform.position = desiredPosition;


    Also, please do not post screenshots of code because if we have to try to replicate what you have we would have to type it all out again. There is a button to post code in the button toolbar when you are typing in your post.

    And one other thing, next time post the entire error message as it will include the script file details and the line number where it is occurring.
     
  3. Floffle

    Floffle

    Joined:
    Feb 9, 2023
    Posts:
    2
    sorry, I haven't posted on the forums before so ill keep what you said in mind if I post again, removing the second position seems to have worked for me , thankyou for the help.