I am a begginer to unity and i’m trying to use the new unity input system but there’s an error. This is the code.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerMovement : MonoBehaviour
{
[SerializeField] private PlayerInput input = null;
private Vector2 moveVector = Vector2.zero;
private void Awake()
{
input = new PlayerInput();
}
private void OnEnable()
{
input.Enable();
input.LightWarrior.Movement.performed += OnMovementPerformed;
input.LightWarrior.Movement.canceled += OnMovementCancelled;
}
private void FixedUpdate()
{
Debug.Log(moveVector);
}
private void Disable()
{
input.Disable();
input.LightWarrior.Movement.performed -= OnMovementPerformed;
input.LightWarrior.Movement.canceled -= OnMovementCancelled;
}
private void OnMovementPerformed(InputAction.CallbackContext value)
{
moveVector = value.ReadValue<Vector2>();
}
private void OnMovementCancelled(InputAction.CallbackContext value)
{
moveVector = Vector2.zero;
}
}
this is the error:
Assets\Scripts\Player\Movement\PlayerMovement.cs(18,15): error CS1061: ‘PlayerInput’ does not contain a definition for ‘Enable’ and no accessible extension method ‘Enable’ accepting a first argument of type ‘PlayerInput’ could be found (are you missing a using directive or an assembly reference?)
for 7 times
This is the organization
and this is the input:

