My player has an Action in the InputSystemInput System Move, that takes a Vector2Vector2 and moves the player based on that input. Straight-forward. I'm using the "Send Messages" behavior on my Player's PlayerInputPlayerInput component.
Player
using UnityEngine;
using UnityEngine.InputSystem;
namespace Core {
public class Player : MonoBehaviour {
public Rigidbody2D Rigidbody { get; private set; }
public CapsuleCollider2D Collider { get; private set; }
public Vector2 MoveDir { get; private set; }
using UnityEngine;
using UnityEngine.InputSystem;
namespace Core {
public class Player : MonoBehaviour {
public Rigidbody2D Rigidbody { get; private set; }
public CapsuleCollider2D Collider { get; private set; }
public Vector2 MoveDir { get; private set; }
private void Start() {
Rigidbody = GetComponent<Rigidbody2D>();
Collider = GetComponent<CapsuleCollider2D>();
}
public void OnMove(InputValue value) {
Debug.Log("OnMove called");
MoveDir = value.Get<Vector2>();
Rigidbody.velocity = MoveDir * 10f;
}
}
}
}