Hi everybody!
I want to create specific tranformation of the camera: when I press GUI buttons, the camera moves up/down (some kind of a zoom) and at the same time it is rotated from X=90 to X=50 and back again. The problem is that I can’t clamp this range of rotation properly.
Here is what I have:

function Update()
{
    transform.localPosition = Vector3( 0, Mathf.Clamp(transform.localPosition.y, MinY, MaxY), Mathf.Clamp(transform.localPosition.z, MinZ, MaxZ));
    transform.eulerAngles = Vector3(Mathf.Clamp(transform.eulerAngles.x, 50.0, 90.0), 0, 0);
}
function OnGUI()
{
    var movement = new Vector3( 0, -60, 27);
    if (GUI.RepeatButton(Rect(ButZIposX,ButZIposY,ButZIwidth,ButZIheight), "Zoom In"))
    {
      transform.Translate(movement * Speed * Time.deltaTime);
      transform.Rotate(Vector3(-1,0,0) * Time.deltaTime);
    }
    if (GUI.RepeatButton(Rect(ButZOposX,ButZOposY,ButZOwidth,ButZOheight), "Zoom Out"))
    {
      transform.Translate(movement * -Speed * Time.deltaTime);
      transform.Rotate(Vector3.right * Time.deltaTime);
    }
}

Is there any suggestions?

You should not rotate and translate in OnGUI, as it is called several times per frame. Besides that, the code seems ok. You can try something different, a lerp between the current rotation and a rotation of 50 (or 90 if going the other way).

PS : -Vector3.right == Vector3(-1,0,0)

It is as easy as a Goo pie))

if (GUI.RepeatButton(Rect(ButZIposX,ButZIposY,ButZIwidth,ButZIheight), "Zoom In"))
	{
    	
    	if (transform.eulerAngles.x > 50.0)
    	transform.Rotate(-Vector3.right * Time.deltaTime);
	}
    
	 if (GUI.RepeatButton(Rect(ButZOposX,ButZOposY,ButZOwidth,ButZOheight), "Zoom Out"))
	{
    	
    	if (transform.eulerAngles.x < 86.0)
    	transform.Rotate(Vector3.right * Time.deltaTime);
	}	

The problem is that Unity reacts incorrectly on values of rotation: after reaching a value of about 87, it shows exactly 90, so when I wrote “transform.eulerAngles.x < 90.0” it stopped rotating without reaching required value

Anyway, thanks for help