Setting value of transform.rotation in code, C#

If I wanted to change the transform.position of an object i’d do this:

Vector3 temp = transform.position;
temp.x = 7f;
transform.position = temp;

I want to do the same thing with transform.rotation, but I don’t know what to replace the Vector3 with.

A Transfom will store rotation as a Quaternion, great for 3D maths but bad for human brains.

One trick you can do is to convert to euler angles (similar to the rotation as displayed in the Inspector):

Vector3 temp = transform.rotation.eulerAngles;
temp.x = 90.0f;
transform.rotation = Quaternion.Euler(temp);

Rotate your character naturally:
transform.Rotate(x, y, z); // Local
transform.Rotate(x, y, z, Space.World); // Global

In case you want to rotate to an absolute angle:
transform.rotation = Quaternion.Euler(x ,y ,z);

There's a lot more to research in the manual.