I had to create a custom Cinemachine AxisState.IInputAxisProvider
to use the Input System’s generated C# code as opposed to the built-in CinemachineInputProvider
because that version caches the actions so any overrides applied later (like for rebinding controls or inverting the axes) are ignored.
Here’s a script for anyone else who runs into this situation:
using System.Linq;
using Cinemachine;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Users;
public class CinemachineLookInputProvider : MonoBehaviour, AxisState.IInputAxisProvider {
protected InputAction Action => GameInputManager.Actions.Gameplay.Look;
public float GetAxisValue(int axis) {
if (base.enabled) {
switch (axis) {
case 0:
return Action.ReadValue<Vector2>().x;
case 1:
return Action.ReadValue<Vector2>().y;
case 2:
return 0f;
}
}
return 0f;
}
}