Euler angles in inspector

Is there a way to see (and change) Euler angles for gameobjects in the Unity inspector instead of quaternion notation? I want X Y Z instead of X Y Z W. I would think Unity would give this option. It’s too difficult to figure out what the angle is in X Y Z W. And, if I do a conversion using a tool and then try to set XYZW in the inspector, other ones change before I can set all 4. So, the only way I can find to set a gameobject’s rotation to an EXACT angle is though code.

After some tests here is how i did it: (using propertyDrawer)

QuaternionToEuler.Cs (inside a folder with the name ‘Editor’)

using UnityEngine;
using UnityEditor;

    public class QuaternionToEulerPropertyDrawer: PropertyDrawer
    	Vector3 euler;
    	bool initialized = false;
    	public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
    		if (!initialized) {
    			euler = property.quaternionValue.eulerAngles; // store the current eulerAngles
    			initialized = true;
    		label.text += " (Quaternion)"; // can be removed, just to know which are Quaternions
    		euler = EditorGUI.Vector3Field (position,label,euler); // display the field.
    		property.quaternionValue =  Quaternion.Euler(euler); // convert the eulerAngles back to Quaternion value.

Note: this script will replace any Quaternion field in any Script and display a vector3 field instead of it.

I don’t quite understand the question. The Transform inspector does show euler angles unless you switched the inspector into debug mode.

Why, specifically, do you need a Quaternion if you’d prefer to work with Euler angles? A simpler option would be to expose a Vector3 to the Inspector and convert it into a Quaternion during serialization or via your Start or Awake methods.

I didn’t find any built in attributes for this, but you could do this on your own as well. You’ll need to add an attribute to your main script folder (something like EulerToQuaternionAttribute) and then create a new property drawer in your editor scripts. The ProperyDrawer page covers how to do this very well. The second example explains how to use custom attributes. I’d recommend taking a shot at this, because understanding editor scripts is a useful skill to have.