90 degrees rotation and then back to 0 again after a 3 second delay

im very new to unity and ive gotten it to turn continuously... but i cant get it to stop at 90 degrees

Here is my code:

var right = true;

function Update () {

if (right)

{ rotation = 100.0; transform.Rotate (0,0,rotation * Time.deltaTime); }

}

You could use the animation view instead and script using animation.Play()

use `transform.eulerAngles` or `transform.localEulerAngles`.

var resetDelay: float = 3.0;
var lastResetTime: float;
var idle: boolean;

function Update() { // assumes Z rotation was 0 to begin with
if (idle) {
var curTime: float = Time.time;
if (curTime > lastResetTime + resetDelay) {
lastResetTime = curTime;
transform.eulerAngles.z = 0;
idle = false; // comment this one out if you only want to reset once
} else {
transform.Rotate(0, 0, 100 * Time.deltaTime);
if (transform.eulerAngles.z >= 90)
idle = true;
}
}