Rotate camera with GetMouseButtonDown()

Hello everyone. I’m trying to modify the MouseLook script in the first person controller to rotate the camera if the right mouse button is down. My modified code is below but doesn’t do anything.

void Update ()
{
	if (axes == RotationAxes.MouseXAndY && Input.GetMouseButtonDown(0))
	{
		float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityX;
		
		rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
		rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
		
		transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0);
	}
	else if (axes == RotationAxes.MouseX && Input.GetMouseButtonDown(0))
	{
		transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivityX, 0);
	}
	else
	{
		if(Input.GetMouseButtonDown(0)){
		rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
		rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
		
		transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0);
		}
	}
}

The function GetMouseButtonDown(0) returns true only once.
You should use GetMouseButton(1), which will return true for every frame the mouse button is down.

Also notice that the integer parameter you’re passing to the function resembles the ID of the mouse button.

0 is the left mouse button, while 1 is the right button.

Cheers