概要
localEulerAngles を使用する方法
using UnityEditor; using UnityEngine; public static class Example { [MenuItem( "CONTEXT/Transform/Example" )] private static void Hoge( MenuCommand command ) { var t = command.context as Transform; t.localEulerAngles = new Vector3( 270, 540, 810 ); } }
localEulerAngles を使用して回転角を設定する場合、数値が自動で補正される
TransformUtils.SetInspectorRotation
using UnityEditor; using UnityEngine; public static class Example { [MenuItem( "CONTEXT/Transform/Example" )] private static void Hoge( MenuCommand command ) { var t = command.context as Transform; TransformUtils.SetInspectorRotation( t, new Vector3( 270, 540, 810 ) ); } }
TransformUtils.SetInspectorRotationを使用する場合、数値をそのまま設定できる