public Vector3 localEulerAngles ;

説明

親の Transform オブジェクトから見た相対的なオイラー角としての回転値

x、y、z の値により、Z軸で z 度、X軸で x 度、Y軸で y 度 回転します。またこの順番で回転します。

Only use this variable to read and set the angles to absolute values. Don't increment them, as it will fail when the angle exceeds 360 degrees. Use Transform.Rotate instead.

using UnityEngine;

public class Example : MonoBehaviour { void Start() { // Print the rotation around the parent's X Axis print(transform.localEulerAngles.x); // Print the rotation around the parent's Y Axis print(transform.localEulerAngles.y); // Print the rotation around the parent's Z Axis print(transform.localEulerAngles.z); } }

Unity automatically converts the angles to and from the rotation stored in Transform.localRotation.