Is there a way to lock the cursor while still detecting mouse movement?

I have a first person camera (I’m using my own first person controller script), but when the player moves the mouse to the edge of the screen, they are unable to rotate the camera anymore, since the camera is based on mouse movement. Is there anyway to prevent this, such as allowing the cursor to wrap around the screen, or by locking the cursor to the center of the screen?

Check out Unity - Scripting API: Cursor.lockState

Cursor.lockState = CursorLockMode.Locked;

You should still be able to detect Mouse Movement via Input.GetAxis("Mouse X") & Input.GetAxis("Mouse Y"). Unity - Scripting API: Input.GetAxis