unity mouse lock and dx and dy detect code example Example: unity mouse lock Cursor.lockState = CursorLockMode.Locked;