Brak opisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

QuaternionPropertyDrawer.cs 704B

1234567891011121314151617181920
  1. using UnityEngine;
  2. namespace UnityEditor.Rendering
  3. {
  4. [CustomPropertyDrawer(typeof(Quaternion))]
  5. class QuaternionPropertyDrawer : PropertyDrawer
  6. {
  7. public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
  8. {
  9. var euler = property.quaternionValue.eulerAngles;
  10. EditorGUI.BeginChangeCheck();
  11. var w = EditorGUIUtility.wideMode;
  12. EditorGUIUtility.wideMode = true;
  13. euler = EditorGUI.Vector3Field(position, label, euler);
  14. EditorGUIUtility.wideMode = w;
  15. if (EditorGUI.EndChangeCheck())
  16. property.quaternionValue = Quaternion.Euler(euler);
  17. }
  18. }
  19. }