Switched to new input system, How can I lock my Freelook camera's Xaxis?

While using the old unity input system, I could remove “Mouse X” via

playerCamera.m_XAxis.m_InputAxisName = string.Empty;

or force

playerCamera.m_XAxis.m_InputAxisValue = 0f;

but after switching to the new input system, the CinemachineInputProvider seems to override everything, even while forcing the input axis value, the camera would still turn.
So what is the best way to lock the camera right now?

Set the InputProvider’s XY axis or Z axis to null. It’s the replacement for axisName.

1 Like

Hi there,
Thanks for the response, but doesn’t this mean that both X&Y axis would be locked at the same time? How can I only lock the X axis but not Y?

You would have to define an action that returns something for Y but not for x, and swap in that action when you want to lock the x

1 Like

:open_mouth: That is actually so big brain! Thank you so much!

1 Like