Look On Cursor Problem

I want my character to look on the mouse cursor so I wrote in the Update method:
“transform.rotation = Quaternion.Euler(0, Input.mousePosition.x * rotateSpeed, 0);”.

the problem is that when the mouse cursor comes to the end of the screen he stop so the player can’t keep rotating.
Anyone help with that?

You can set the lockState of the Cursor to CursorLockMode.None. to track the mouse position even when the cursor isn’t in the games window.

Information took from the documentation: Unity - Scripting API: Cursor.lockState

Note: Input.mousePosition reports the position of the mouse even when it is not inside the Game View, such as when Cursor.lockState is set to CursorLockMode.None.