mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-22 08:08:51 -05:00
Fixing a Rendering issue of QuaternionReferenceDrawer
due to an unity bug with the result of GetPropertyHeight for Quaternion properties we need to handle Quaternions as special cases Commit-Type: Bugfix
This commit is contained in:
parent
37ead24dbb
commit
576afed000
@ -82,7 +82,14 @@ namespace UnityAtoms.Editor
|
|||||||
{
|
{
|
||||||
var expanded = usageTypeProperty.isExpanded;
|
var expanded = usageTypeProperty.isExpanded;
|
||||||
usageTypeProperty.isExpanded = true;
|
usageTypeProperty.isExpanded = true;
|
||||||
var valueFieldHeight = EditorGUI.GetPropertyHeight(usageTypeProperty, label);
|
var valueFieldHeight = usageTypeProperty.propertyType switch
|
||||||
|
{
|
||||||
|
// In versions prior to 2022.3 GetPropertyHeight returns the wrong value for "SerializedPropertyType.Quaternion"
|
||||||
|
// In later versions, the fix is introduced _but only_ when using the SerializedPropertyType parameter, not when using the SerializedProperty parameter version.
|
||||||
|
// ALSO the SerializedPropertyType parameter version does not work with the isExpanded flag which we set to true exactly for this reason a (few) lines above.
|
||||||
|
SerializedPropertyType.Quaternion => EditorGUI.GetPropertyHeight(SerializedPropertyType.Vector3, label),
|
||||||
|
_ => EditorGUI.GetPropertyHeight(usageTypeProperty, label),
|
||||||
|
};
|
||||||
usageTypeProperty.isExpanded = expanded;
|
usageTypeProperty.isExpanded = expanded;
|
||||||
|
|
||||||
if (usageTypePropertyName == "_value" && (valueFieldHeight > EditorGUIUtility.singleLineHeight + 2))
|
if (usageTypePropertyName == "_value" && (valueFieldHeight > EditorGUIUtility.singleLineHeight + 2))
|
||||||
|
Loading…
Reference in New Issue
Block a user