using unityengine.input system code example
Example 1: unity controller input
float moveSpeed = 10;
float horizontalInput = Input.GetAxis("Horizontal");
float verticalInput = Input.GetAxis("Vertical");
transform.Translate(new Vector3(horizontalInput, 0, verticalInput) * moveSpeed * Time.deltaTime);
Example 2: unity input system not working
PlayerControls controls;
private void Awake()
{
controls = new PlayerControls();
}
private void OnEnable()
{
if (usingController)
{
controls.Gameplay.Enable();
}
}
private void OnDisable()
{
if (usingController)
{
controls.Gameplay.Disable();
}
}