Unity set transform.rotation.eulerangles code example
Example 1: simple reset transform.rotation c#
transform.rotation = Quaternion.identity;
Example 2: how to clamp transform.rotation
headRotation = Input.GetAxis("Mouse Y") * speed;
transform.Rotate(0, 0, -headRotation, Space.Self);
transform.eulerAngles.y = Mathf.Clamp(transform.eulerAngles.y, -90, 90);