transform.eulerAngles Property in Unity

Notes:

transform.eulerAngles Property in Unity:

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

- 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.eulerAngles:

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

public class CubeController : MonoBehaviour {

public Vector3 currentRotation;
public Vector3 anglesToRotate;

// Use this for initialization
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);
this.transform.eulerAngles = currentRotation;
}

// Update is called once per frame
void Update () {
currentRotation = currentRotation + anglesToRotate * Time.deltaTime;
currentRotation = new Vector3 (currentRotation.x % 360f,currentRotation.y % 360f,currentRotation.z %360f);
this.transform.eulerAngles = currentRotation;
}
}