how to rotate obj with degree

I want to rotate object 45 degress.How to to that?If I use transform.Rotate , it rotates 360 how to set deadline?

Not sure what you mean - can you post your code?

var rotSpeed = 60.00;
function Update () {
if (Input.GetButton(“Horizontal”)){
var rotat =Time.deltaTime * rotSpeed;
transform.Rotate(0,0,rotat);

}
}
My object rotates 360 degrees all the time, but I want to stop it rotate when reach 45 degrees.

I’m no expert on rotations, and certainly no expert on vectors, but maybe something like:

var rotSpeed = 60.00;
function Update () {
  if (Input.GetButton("Horizontal")){
    if (transform.eulerAngles.y <= 90) {
      var rotat =Time.deltaTime * rotSpeed;
      transform.Rotate(0,0,rotat);
    }
  }
}

You have that code in an Update() method, so it will apply a rotation every frame as long as there is user input. The rotation is cumulative (relative to the result of the previous rotation), so the object will continue to rotate. If you want to rotate of some ‘default’ orientation R to an orientation of R + 45 degrees, you need to code that explicitly – store your base rotation in a variable (e.g. baseRotation), then if Input.GetButton(…) set the object’s rotation to (baseRotation + (0,0,45)).

The use of rotSpeed * Time.deltaTime suggests you’re looking to get a smooth rotation; to do that, you can use Vector3.Lerp(). Get it working without lerp first, though, since that will just complicate things to start with. Once you’ve understood the rotation, you can add in the lerp logic to make it happen smoothly.