rotate object with degrees

I want to rotate an object 90 degrees because doing Mathf.PI / 2 me it always turns 180 degrees?

ogg.transform.rotation.z = Mathf.PI / 2;

‘transform.rotation’ is a Quternion. The individual components (x,y,z,w) are not angles in any form (radians or degrees). If you want a relative rotation, you can do:


If you want an absolute rotation, you can do:

 transform.eulerAngles = Vector3(0,0,90);