title: How to convert Input.GetAxis("Mouse X") or Input.GetAxis("Mouse Y") to the new Input System?
body: <p>I'm new on Unity Scripting, and I'm trying to make a ThirdPersonCamera, so following <a href="https://www.youtube.com/watch?v=sNmeK3qK7oA" rel="nofollow noreferrer">this tutorial</a> he can move the mouse up and down, and left and right correctly</p>
  <p><a href="https://i.stack.imgur.com/yHein.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yHein.gif" alt="enter image description here" /></a></p>
  <p>The script used was</p>
  <pre><code>posY += Input.GetAxis(&quot;Mouse X&quot;) * mouseSensitivity;
  posX -= Input.GetAxis(&quot;Mouse Y&quot;) * mouseSensitivity;
  // mouseSensitivity can be changed
  
  Vector3 targetRotation = new Vector3(posX, posY);
  transform.eulerAngles = targetRotation;
  </code></pre>
  <p>Due to the new Input System, using <code>Input.GetAxis(&quot;Mouse X&quot;)</code> throws an <code>InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings</code> error.</p>
  <p>So I tried to use</p>
  <pre><code>private PlayerInputMovement inputCamera;
  
  void Awake(){
      inputCamera = new PlayerInputMovement();
      inputCamera.Player.Camera.performed += context =&gt; cameraInput = context.ReadValue&lt;Vector2&gt;();
  }
  
  void Update(){
      Camera();
  }
  
  void Camera(){ 
      posY += cameraInput.x * mouseSensitivity;
      posX -= cameraInput.y * mouseSensitivity;
      // mouseSensitivity can be changed
  
      Vector3 targetRotation = new Vector3(posX, posY);
      transform.eulerAngles = targetRotation;
  }
  </code></pre>
  <p>And got this, but if I keep my mouse on an axis, it keeps rotating to that side</p>
  <p><a href="https://i.stack.imgur.com/9MGOP.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9MGOP.gif" alt="enter image description here" /></a></p>
  <p>So... is this a correct way to replace the old <code>Input.GetAxis(&quot;Mouse X&quot;)</code> or <code>Input.GetAxis(&quot;Mouse Y&quot;)</code> to the new Input System? How can I stop it from keeping rotating?</p>