How to rotate a plane with script?

I want to rotate a plane around one side with a script. I want it to rotate left over the y-axis if you press the left button and rotate right when right is pressed. I haven’t created the animations.


function Update () 
plane.transform.eulerAngles.y -= value // or += value if want to rotate in the other direction

This should work…theoretically…haven’t tested it…

var rotSpeed : float;

functin Update() {
    if(Input.GetAxis("Horizontal")) {
        transform.Rotate(Vector3.forward * Input.GetAxis("Horizontal") * rotSpeed * Time.deltaTime);

GameObject thisPlane = GameObject.CreatePrimitive(PrimitiveType.Plane); //create plane
thisPlane.transform.position = new Vector3(1, 1, 1); //set position
thisPlane.transform.Rotate(-90, 0, 0); //set rotation