using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; public class PlayerController : MonoBehaviour { Vector2 movementValue; [SerializeField] float speed; [SerializeField] Rigidbody2D rb; // Start is called before the first frame update void Start() { } void OnMove(InputValue value) { this.movementValue = value.Get() * speed; } // Update is called once per frame void Update() { this.rb.AddForce(new Vector3(this.movementValue.x, 0, this.movementValue.y)); } }