From a9763b033d4cbf0faaee426e5805b9e603657260 Mon Sep 17 00:00:00 2001 From: Makihiro Date: Mon, 1 Apr 2024 16:32:53 +0900 Subject: [PATCH] Fix foldout layout on Unity 2022.2 or newer --- .../Editor/SubclassSelectorDrawer.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Assets/MackySoft/MackySoft.SerializeReferenceExtensions/Editor/SubclassSelectorDrawer.cs b/Assets/MackySoft/MackySoft.SerializeReferenceExtensions/Editor/SubclassSelectorDrawer.cs index 1522679..5357679 100644 --- a/Assets/MackySoft/MackySoft.SerializeReferenceExtensions/Editor/SubclassSelectorDrawer.cs +++ b/Assets/MackySoft/MackySoft.SerializeReferenceExtensions/Editor/SubclassSelectorDrawer.cs @@ -56,7 +56,13 @@ public override void OnGUI (Rect position, SerializedProperty property, GUIConte { Rect foldoutRect = new Rect(position); foldoutRect.height = EditorGUIUtility.singleLineHeight; + +#if UNITY_2022_2_OR_NEWER + // NOTE: Position x must be adjusted. + // FIXME: Is there a more essential solution...? foldoutRect.x -= 12; +#endif + property.isExpanded = EditorGUI.Foldout(foldoutRect, property.isExpanded, GUIContent.none, true); }