First time coding - Roll a Ball tutorial code not working, multiple errors

Hello all! im sure im not the first to come here with these questions, but im at the early stage where i dont even know what to google to get answers. I have my code here and for the life of me it looks identical to the code shown in roll a ball tutorial part 2 step 7. ‘Apply force to the Player’

Below is my code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{

    private Rigidbody rb;
    private float movementX;
    private float movementY;


    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
      rb = GetComponent<Rigidbody>();

    }

    void OnMove(InputValue MovementValue) 
    { 
        Vector2 MovementVector = MovementValue.Get<Vector2>

        movementX = MovementVector.X;
        movementY = MovementVector.Y;

    }

    void fixedupdate()
    {
        Vector3 movement = new Vector3 (movementX, 0.0f, movementY);

       rb.addforce(Movement);
    }
}

now i can tell something is off as my ‘vector2’ text on line 23 doesnt turn green as theirs does in the tutorial, but again, i dont know were to start in looking to fix this.

All in all i get flagged with 6 errors when tryin gto run this code

  • Assets\Scripts\PlayerController.cs(23,52): error CS0119: ‘Vector2’ is a type, which is not valid in the given context
  • Assets\Scripts\PlayerController.cs(25,36): error CS1061: ‘Vector2’ does not contain a definition for ‘X’ and no accessible extension method ‘X’ accepting a first argument of type ‘Vector2’ could be found (are you missing a using directive or an assembly reference?)
  • Assets\Scripts\PlayerController.cs(26,36): error CS1061: ‘Vector2’ does not contain a definition for ‘Y’ and no accessible extension method ‘Y’ accepting a first argument of type ‘Vector2’ could be found (are you missing a using directive or an assembly reference?)
  • Assets\Scripts\PlayerController.cs(25,21): error CS0165: Use of unassigned local variable ‘MovementVector’
  • Assets\Scripts\PlayerController.cs(34,20): error CS0103: The name ‘Movement’ does not exist in the current context
  • Assets\Scripts\PlayerController.cs(34,11): error CS1061: ‘Rigidbody’ does not contain a definition for ‘addforce’ and no accessible extension method ‘addforce’ accepting a first argument of type ‘Rigidbody’ could be found (are you missing a using directive or an assembly reference?)

Im sorry if this looks like alot for you (imagine how it looks for me)

I am working on unity 6 on the day of posting this

Any and all help would be very appreciated, hitting such a unexpected wall so early has been quite disheartening

Thank you

maybe related

Thank you for responding, i can confirm that i have a player input component, But i have spotted a difference with the tutorial project and my project.

Under the ‘Actions’ tab in player input i ONLY have the option of choosing ‘None’ or ‘InputSystem_Actions’. While the tutorial seems to have the option of ‘InputAssets’

hopefully the image attached below will show this off better, its my project for context

If this is something that will mess with it please do let me know how to fix

You have definitely not been following the tutorial closely enough as there’s multiple errors throughout your code. Start again, take it slower, play attention to every detail. Code syntax has to be 100% correct.

As much as i believe yes my code must be riddled with issue

But I’ve noticed ALOT of difference with the unity i am looking at and the unity being used in the tutorial.

And watching the tutorial again (and again and again) it seems the user is jumping around versions.

Anyhow, this basically culminates in the fact its impossible to follow 1 to 1, and the issue i found above with the player input

The Unity version won’t really make a different here, as aside from the Input System, this tutorial only really covers fundamentals that haven’t changed for a long time.

Just follow the tutorial closely, particularly paying attention to their code.

For example here you wrote this:

Which is definitely missing something at the end of the line compared to what the tutorial clearly shows:

yes, take it slow and pay attention to details and try to understand every new concept that is introduced.

When I’m trying to learn something from a tutorial, it is quite impossible the the tutorial author managed to include clear details and perfect explanation. It happened only once that I’ve found the “near perfect” tutorial, in decades of my time with computers. So when you don’t understand what the tutorial author is trying to explain take a pause and search the web and youtube for that particular term or concept, read and watch different explanations till you understand it. Only then continue. In no time all this will appear obvious and more importantly you will not lose time copying code and in the end not understanding what all was about.

First of All, thank you both altepTest and spiney199!

you have the patients of saints to deal with a raging idiot who assumed he obviously did it all correct

I had a sleep, and tried out the coding again, but slower, and its all worked out perfectly (i feel like this will be a long road ahead of me.

Anyone in the future who stumbles apon this in need of help, the solution is here …