Pulling my hair out with rotations

All I want to do is set the a certain object when the script starts (with a certain variable) to a certain position, and a certain rotation. Why doesn’t this work?

function Start(){
	if(PlayerPrefs.GetInt("CG_Started",0)==0){
		transform.position.x=-8.424879;
		transform.position.y=2.021559;
		transform.position.z=-7.628238;
		transform.eulerAngles.y=-180;
		transform.eulerAngles.z=180;
	}
}

It sets the position just fine, but the rotations keep screwing up and I can’t figure out why. Does anyone know?

Set the whole Vector3 for eulerAngles at once, instead of one element at a time. (This is mentioned in the docs.)

–Eric