UnityGame/Library/PackageCache/com.unity.render-pipelines.core/Editor/QuaternionPropertyDrawer.cs

21 lines
704 B
C#
Raw Permalink Normal View History

2024-10-27 10:53:47 +03:00
using UnityEngine;
namespace UnityEditor.Rendering
{
[CustomPropertyDrawer(typeof(Quaternion))]
class QuaternionPropertyDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var euler = property.quaternionValue.eulerAngles;
EditorGUI.BeginChangeCheck();
var w = EditorGUIUtility.wideMode;
EditorGUIUtility.wideMode = true;
euler = EditorGUI.Vector3Field(position, label, euler);
EditorGUIUtility.wideMode = w;
if (EditorGUI.EndChangeCheck())
property.quaternionValue = Quaternion.Euler(euler);
}
}
}