InputAction broken?

The following code provides this error : Assets\Game\Scripts\Move2d.cs(11,22): error CS0246: The type or namespace name ‘InputAction’ could not be found (are you missing a using directive or an assembly reference?)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class Move2d : MonoBehaviour
{
private Rigidbody2D _rigidbody2D;
public float m_speed = 1.0f;
private Vector2 _userinput;
public void Move(InputAction.CallbackContext context)
{
_userinput = context.ReadValue();
}
void Start()
{
_rigidbody2D = GetComponent();
}
void FixedUpdate()
{
_rigidbody2D.MovePosition(_rigidbody2D.position + _userinput * Time.fixedDeltaTime * m_speed);
}
}

I haven’t any idea why I can’t use InputAction , I even tried the all powerful ChatGPT but got nowhere.

Hello, just to check with you if you have already installed the Input System package from the Package Manager (which can be accessed from the top menu Window → Package Manger)

Otherwise, it will be faster to get relevant replies and information in the Input System forum section

2 Likes

Thank you sir i am a noob who didn’t install the package!

1 Like