set rotation of object in code unity code example
Example: how to chagne rotation in unity
transform.eulerAngles = new Vector3(0f, 180f, 0f); // rotates 180 degrees
transform.eulerAngles = new Vector3(0f, 180f, 0f); // rotates 180 degrees