Roll-A-Ball Script Error

Hi, I’m new to Unity and I’m trying to make the minigame of Roll-a-Ball.
I’m facing problem even I had followed the tutorial, enter the code to the Visual Studio.

The code

using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
    private Rigidbody rb;
    private float movementX;
    private float movementY;

    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    void OnMove(InputValue movementValue) {
        Vector2 movementVector = movementVector.Get<Vector2>();

        movementX = movementVector.x;
        movementY = movementVector.y;
    }

    // Update is called once per frame
    void FixedUpdate()
    {
        Vector3 movement = new Vector3(movementX, 0.0f, movementY);

        rb.AddForce(movement);
    }
}

When going to compile, it shows this:

You need to pay closer attention to detail. It should be Vector2 movementVector = movementValue.Get<Vector2>();

1 Like

OMG, thanks lots :sweat_smile:
Finding the bug in the sake of hours… I think I should take a nap to refresh my mind… :frowning:
Anyway, thanks, I will be alert more in the future : )