I put this in the code like Rick said:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerMovement : MonoBehaviour
{
Vector3 moveInput;
Rigidbody2D myRigidbody;
void Start()
{
myRigidbody = GetComponent<Rigidbody2D>();
}
void Update()
{
Run();
}
void onMove(InputValue value)
{
moveInput = value.Get<Vector3>();
Debug.Log(moveInput);
}
void Run()
{
myRigidbody.velocity = moveInput;
}
}
I also put the input system too.
Can anyone help me?