unity 2d rotation script code example
Example 1: rotation unity script 2d
transform.eulerAngles = Vector3.forward * degrees;
transform.rotation = Quaternion.Euler(Vector3.forward * degrees);
transform.rotation = Quaternion.LookRotation(Vector3.forward, yAxisDirection);
transform.LookAt(Vector3.forward, yAxisDirection);
transform.right = xAxisDirection;
transform.up = yAxisDirection;
Example 2: rotation unity script 2d
transform.Rotate(Vector3(0, 0, 50));
transform.eulerAngles = new Vector3 (0, 0, 50);
transform.eulerAngles = Vector3.forward * 50;