Setting an object to a set Rotation

I am having trouble understanding what I needed to do to set the actual rotation, as in it’s rotation position, NOT making it rotate around an axis. I’ve tried using transform.Rotate() but I understand it’s meant for making an object turn around an axis.

Specifically speaking, I want a directional light, when I pass the line(s) of code, to rotate immediately to (270,0,0) (i.e. Straight up), preferably in JS. Any idea how I could do this?

Thank you in advance.

transform.rotation = myRotation

Where you set the rotation to whatever you want. Try:

Quaternion.Euler

The easiest way to do this would be to get another object and rotate it (270, 0, 0) like you said. Then use this script:

var howToRotate : Transform;

function Update(){
          gameObject.tranform.rotation = howToRotate.rotation;
}

This assumes that the script is on the light and you want it to always be this rotation, so you might want to edit it however you want. Also, howToRotate is the game object that is rotated the way you want to rotate the light.