using rotation in an if statement

this is what's going on so far... another script is rotating my sun along the x axes... and im getting dodgy shadows at night

in the day the suns rotation on the x never goes above 100 so this should work, i think iv'e worded the if statement wrong can some1 please tell me what i should use instead. thanx.

var Sun : Transform;

function Update(){

if(Sun.transform.rotation.x < 100){
    GetComponent("Light").enabled = true;
else {
    GetComponent("Light").enabled = false;


Use `transform.eulerAngles` instead of `rotation` for while the first is the normal angle thingy(with 360 meaning a full rotation and stuff), the other is a `Quaternion` whose components mean different stuff.

Also `Sun` is of type `Transform` so you should just write `Sun.eulerAngles.x`