unity 2d player rotation 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: 2d rotation unity
float x;
void Update ()
{
x += Time.deltaTime * 10;
transform.rotation = Quaternion.Euler(x,0,0);
}