how can i import the value of quaternion.eulerangles

how can i import the value of quaternion.eulerangles

using UnityEngine;

// demonstration of eulerAngles not returning the same values as assigned
public class EulerAnglesProblemExample : MonoBehaviour
    private void Start()
        Quaternion myRotation = Quaternion.identity;
        myRotation.eulerAngles = new Vector3(150, 35, 45);


        // output is: (30.0, 215.0, 225.0)

You can take the help of this code to sync the format

A Quaternion is different than Euler Angles regardless, as I’ve never had the degrees match up. But in your example you show:

Quaternion myRotation = Quaternion.identity;

which is basically saying myRotation equals (0,0,0,0). Then you’re trying to change myRotation to say in Euler (150,35,45). I think you are looking for

Quaternion myRotation = Quaternion.Euler(new Vector3 (150,35,45));

In the documentation: Unity - Scripting API: Transform.eulerAngles

When you read the .eulerAngles
property, Unity converts the
Quaternion’s internal representation
of the rotation to Euler angles.
Because, there is more than one way to
represent any given rotation using
Euler angles, the values you read back
out may be quite different from the
values you assigned. This can cause
confusion if you are trying to
gradually increment the values to
produce animation.