So, I trying to get used to the new Unity input system. "Back in the days" I just got the Vertical/Horizontal axis, put them into a Vector3, multiplied them by a certain value and then moves the player.
Now, with the new input system, that changed quite a bit. So, what I'm trying to do is, to get the input of a 2D Vector, earlier called DPAD in the new system. My approach was, like
private void Awake() {
InputAction.performed += ctx => Movement(ctx.ReadValue<Vector2>());
InputAction.canceled += ctx => Movement(ctx.ReadValue<Vector2>());
}
private void OnMovement(Vector2 _dir) {
moveDirection = _dir;
}
//This performed in FixedUpdate
private void Move() {
transform.position += moveDirection * moveSpeed * Time.deltaTime;
}
Buut, you know, kinda worked, but not really. The player did unintended things like keep moving or not reacting at all to my button press. Maybe I set something wrong up. You might help me please, thanks!