Search Unity

Movement Scripts: C# failing to recognize functions

Discussion in 'Getting Started' started by Maverick_006, Jan 5, 2023.

  1. Maverick_006

    Maverick_006

    Joined:
    Dec 26, 2022
    Posts:
    2
    Hi All,

    I'm very new to all of this and looking for some wisdom on a problem I'm having. I'm working on my first game and just trying to get top-down movement working. No success to speak of so far. It would seem that the failure point is in my C# scripts. More specifically, my C# compiler seems to be struggling with identifying the code I'm putting into it.

    Context:

    I've been working along side this tutorial:


    I'm using Unity personal and the JetBrains Rider to compile. Please check out the screenshots I included below of my code and the error messages I'm receiving. The smallest error image that states ; expected at (33,50) appears when I leave out the ; CharacterMovement code(first code below). The other 5 error message come up after I input that ; .

    As said previously, I'm very new to all of this so I'm sure the answer is simple. But, in any case, I am appreciative of your help!

    Screen Shot 2023-01-04 at 8.44.21 PM.png Screen Shot 2023-01-04 at 8.44.57 PM.png Screen Shot 2023-01-04 at 8.45.23 PM.png Screen Shot 2023-01-04 at 8.46.22 PM.png
     

    Attached Files:

  2. AngryProgrammer

    AngryProgrammer

    Joined:
    Jun 4, 2019
    Posts:
    490
    It looks like you don't have Visual Studio properly configured to work with Unity. Because Visual Studio should highlight you the error spots.
    1. Analyzing from the end: error is in CharacterMovement.cs in line 33 (it literally says it in the message).
    2. Method transform.translate does not exist, should be transform.Translate (methods are capitalized).
    3. There are probably more bugs, but compiler bugs are self-solvable. It's like making coffee every day.
    Ignore this tutorial and do it the RIGHT way:
    https://learn.unity.com/pathway/junior-programmer

    Tutorials on YouTube are not a learning material, but a quick preview of an idea. Learning is systematic and long. The above link is 12 weeks (4-5 hours per week). Then go back to what you were doing and you will see the difference.
     
    Last edited: Jan 5, 2023
  3. Maverick_006

    Maverick_006

    Joined:
    Dec 26, 2022
    Posts:
    2
    Hey thanks for sharing that. I'll look into that course!
     
  4. tleylan

    tleylan

    Joined:
    Jun 17, 2020
    Posts:
    618
    Also trust the messages that Visual Studio outputs on your behalf. You don't have a property InputVector because you defined it as InpuntVector.
     
  5. RichAllen2023

    RichAllen2023

    Joined:
    Jul 19, 2016
    Posts:
    1,026
    I hate to be pedantic, but when you're typing in code, DEFINITELY watch your spelling and grammar, it's VERY sensitive.