Rotation problem.

I have a gameobject whose rotation i have set as (45,0,0);

Now in the script (which is attached to the above gameobject) if i write this

void Update()
{
transform.rotation = Quaternion.Euler(this.transform.rotation.x , this.transform.rotation.y, this.transform.rotation.z);
}

And now if i play its rotation is changed to (0,0,0). Am I doing anything wrong?

‘transform.rotation’ is a Quaternion…a 4D construct that is difficult to deal with intuitively. It’s x,y,z, and w do not represent angles in degrees. ‘transform.eulerAngles’ is more what you are looking for, but there are multiple euler angle representations for any ‘physical’ rotation. For example you might set the rotation to (180,0,0) only to immediately read it back and get (0,180,180).