transform.rotation Property in Unity

Notes:

transform.rotation Property in Unity:

transform.rotation:
- stores the rotation of a game object relative to world coordinate system in the form of Quaternions

- is used to set rotation of a game object relative to world coordinate system
- is used to rotate a game object relative to world coordinate system

Rotation using transform.rotation property:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CubeController : MonoBehaviour {

public Vector3 currentRotation;
public Vector3 anglesToRotate;

void Start () {
currentRotation = new Vector3 (currentRotation.x % 360f,currentRotation.y % 360f,currentRotation.z %360f);
anglesToRotate = new Vector3 (anglesToRotate.x % 360f,anglesToRotate.y % 360f,anglesToRotate.z %360f);

Quaternion rotationY = Quaternion.AngleAxis(currentRotation.y,new Vector3(0f,1f,0f));
Quaternion rotationX = Quaternion.AngleAxis (currentRotation.x, new Vector3 (1f, 0f, 0f));
Quaternion rotationZ = Quaternion.AngleAxis (currentRotation.z, new Vector3 (0f, 0f, 1f));
this.transform.rotation = rotationY * rotationX * rotationZ;

}

void Update () {

Quaternion rotationY = Quaternion.AngleAxis(anglesToRotate.y * Time.deltaTime,new Vector3(0f,1f,0f));
Quaternion rotationX = Quaternion.AngleAxis (anglesToRotate.x * Time.deltaTime, new Vector3 (1f, 0f, 0f));
Quaternion rotationZ = Quaternion.AngleAxis (anglesToRotate.z * Time.deltaTime, new Vector3 (0f, 0f, 1f));
this.transform.rotation = this.transform.rotation * rotationY * rotationX * rotationZ;

currentRotation = currentRotation + anglesToRotate * Time.deltaTime;
currentRotation = new Vector3 (currentRotation.x % 360f,currentRotation.y % 360f,currentRotation.z %360f);

}
}

Note:
Rotation relative to world co-ordinate system:
this.transform.rotation = this.transform.rotation * rotationY * rotationX * rotationZ;

Rotation relative to parent co-ordinate system & avoid gimbal lock:
this.transform.rotation = rotationY * rotationX * rotationZ * this.transform.rotation ;