For context I am very much a beginner.
I have been trying to get the player to move using Unity's new Input System following this tutorial. It's only a year old and others in the comments seemed to have figured it out okey; some people have had troubles like me though. I followed the tutorial again very closely and could not see that I did anything wrong. I have previously been able to use Unity's old Input System well but never tried this one.
I opened and closed Unity, and uninstalled and then reinstalled the new Input system. I made sure that the settings were set to use both legacy and new Input.
I am not receiving any errors in the script or console.
Screenshot of settings:
Code:
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerMovement : MonoBehaviour
{
private float moveSpeed = 5;
private Rigidbody2D rb;
private Vector2 moveInput;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
rb.linearVelocity = moveInput * moveSpeed;
}
public void Move(InputAction.CallbackContext context)
{
Debug.Log("Function called.");
moveInput = context.ReadValue<Vector2>();
}
}
