Basically all I want to do is make an editor for a rotation, exactly like the one Unity uses for transform.rotation (that is, with x, y, z only, not w). I can get EditorGUILayout.Vector3Field to work fine for normal Vector3 fields, but for some reason I am having a strange problem when I try to convert a Quaternion to a Vector3, create a Vector3Field for it, and then convert the returned value back to a Quaternion.
The problem is that when I go to edit a number in this Vector3Field, the value for that number seems to wiggle around for a second or two before returning back to zero. I have no explanation for this. Here is the relevant line from my editor:
You use the Quaternion wrong The 4 components of a quaternion has nothing to do with eulerAngles. It is actually some kind of complex number which represents a normalized direction vector and a rotation around that vector. If you don’t actually know how a quaternion works, you should never read or write any of the components of a quaternion.
A quaternion can be converted into eulerAngles. However if you want to do the same as the Transform inspector you should store your euler angles as Vector3 and convert it to a quaternion when you need it. The TransformInspector of Unity uses transform.localEulerAngles more or less directly. However inside the editor it seems that the eulerAngles property holds a cached version in memory. At edit time you can set the angles to any number you like even greater than 360. At runtime it behaves differently because the angles get calculates from the quaternion and therefore will always be within the 360° range.