Rotation of gameobject doesn't assign properly with script

I have a script that updates the rotation of weapon gameobject.
this is what I have in my script :

 m_Weapon.transform.localRotation = new Quaternion(346.4452f, 159.1398f, 276.7879f, 1);

But when I start the game, what I see in the inspector is this:

X : 336.8104
Y : 109.688
Z : 147.1012


I’m pretty sure that there is only one script that controls the rotation of the weapon.

what I have done wrong???


A Quaternion is not Euler representation of rotation. If you want to use the more intuitive Euler representation you can use:

m_Weapon.transform.localRotation = Quaternion.Euler(x, y, z);

where the x , y and z components are the angles measured in degrees.