unity object rotation script code example
Example 1: unity how to change rotation
transform.eulerAngles = new Vector3(0f, 180f, 0f); //rotates 180 degrees
Example 2: rotation unity script 2d
transform.Rotate(Vector3(0, 0, 50));
//instead of :
transform.eulerAngles = new Vector3 (0, 0, 50);
//or like you said
transform.eulerAngles = Vector3.forward * 50;