Rotate and eulerAngles don't work together ??

Hi !
I’ve encountered an error when changing rotation into Rotate in front of euler angles

var Statue : GameObject;

var MinClamp1 = 0f;
var MaxClamp1 = 90f;
var MinClamp2 = 90f;
var MaxClamp2 = 180f;
var MinClamp3 = 180f;
var MaxClamp3 = 270f;
var MinClamp4 = 270f;
var MaxClamp4 = 360f;
var RotationLimit = 0;
function Update () {
if (Statue.transform.rotation.y > 360){
Statue.transform.rotation.y = 0;
}
if (RotationLimit == 4){
RotationLimit = 0;
}
}


function OnTriggerStay(other : Collider){
if (other.gameObject.tag == "Boite" && RotationLimit == 0){
  Statue.transform.rotation.eulerAngles =  new Vector3(Statue.transform.rotation.eulerAngles.x,Mathf.Clamp(Statue.transform.rotation.eulerAngles.y, MinClamp1, MaxClamp1),
          Statue.transform.rotation.eulerAngles.z);
		  }
		  if (other.gameObject.tag == "Boite" && RotationLimit == 1){
  Statue.transform.rotation.eulerAngles =  new Vector3(Statue.transform.rotation.eulerAngles.x,Mathf.Clamp(Statue.transform.rotation.eulerAngles.y, MinClamp2, MaxClamp2),
          Statue.transform.rotation.eulerAngles.z);
		  }
		  if (other.gameObject.tag == "Boite" && RotationLimit == 2){
  Statue.transform.rotation.eulerAngles =  new Vector3(Statue.transform.rotation.eulerAngles.x,Mathf.Clamp(Statue.transform.rotation.eulerAngles.y, MinClamp3, MaxClamp3),
          Statue.transform.rotation.eulerAngles.z);
		  }
		  if (other.gameObject.tag == "Boite" && RotationLimit == 3){
  Statue.transform.rotation.eulerAngles =  new Vector3(Statue.transform.rotation.eulerAngles.x,Mathf.Clamp(Statue.transform.rotation.eulerAngles.y, MinClamp4, MaxClamp4),
          Statue.transform.rotation.eulerAngles.z);
		  }
}
function OnTriggerExit(other : Collider){
++RotationLimit;
}

it works , but I’d like to make it rotate slowly like using Rotate instead of rotation , how should I do ?

I had no time to test this, but I think it does exactly what you’re trying to do - replace your script with this one and tell me if you have any problem:

var Statue : GameObject;
private var rotating = false; 

function OnTriggerEnter(other : Collider){
	if (other.gameObject.tag == "Boite"){
		RotateY(Statue.transform, 90, 1.1);  // rotate gradually 90 around Y
	}
}

function RotateY(transf: Transform, angle: float, time: float){
	if (rotating) return;  // ignore other calls while rotating
	rotating = true;  // flag to indicate "I'm rotating already"
	var t: float = 0;
	var euler = transf.eulerAngles;
	var init = euler.y;
	var end = init + angle;
	while (t < 1){  // t will vary from 0 to 1 in time seconds
		t += Time.deltaTime / time;  
		euler.y = Mathf.Lerp(init, end, t);  // define Y angle proportional to t
		transf.eulerAngles = euler;
		yield;  // return here in the next frame
	}
	rotating = false;  // finished rotating
}

Use this.

http://unity3d.com/support/documentation/ScriptReference/Vector3.RotateTowards.html

Or if you're into quaternions, you can use

http://unity3d.com/support/documentation/ScriptReference/Quaternion.RotateTowards.html