Unity-SerializeReferenceExtensions icon indicating copy to clipboard operation
Unity-SerializeReferenceExtensions copied to clipboard

[IMPROVE] Consistence with Unity indentation

Open Simferoce opened this issue 1 year ago • 1 comments

Improvement destription

The indentation of the field does not correspond to Unity expected indentation for nested SerializeReference.

Indentation between the foldout and the label: image image

The position of the foldout element does not correspond to what is expected either. Note: unity use 15 indent pixel. image

image

The dropdown is more indented then what we expect. image image

Schema: (AbilityDefinition - ScriptableObject) -- [SerializeReference] (Ability - Plain Old C# Object) ---- [SerializeReference] (Statistic - IStatisticFloat)

Version: 2022.1.8f1, Library Version: 1.3.1

Simferoce avatar Apr 08 '24 18:04 Simferoce

Oh, I'm digging into the problem and realize that Unity has some regression here... Have a fix which solves mentioned but only on version 2020. 2022 & 2024 have weird behavior

Tried to add dirty hack for those versions but stuck into the problem: Nested foldouts aren't drawn properly even with custom drawer which only useEditorGUI.PropertyField() and nothing else

For example this for comparing versions:

2020 (all is correct) 2020 - correct

2022 (look at Property 2/3 arrow and label horizontal positions) 2022 - incorrect

Unity Tech added some bugs into EditorGUI.Foldout control, but I can't understand where, and I don't have an Idea how to fix it - any nested property foldouts drawn incorrect if you use custom drawer.

Maligan avatar Apr 26 '24 01:04 Maligan

In the last update, I used the define directive to address the drawing issue between Unity versions, but it didn't completely fix it.

I also tried to migrate to UIElements, but the current UnityEditor API is insufficient here to completely replace the functionality of this package from IMGUI to UIElements. https://github.com/mackysoft/Unity-SerializeReferenceExtensions/issues/51#issuecomment-2266849134

I'll close this issue once as it's not critical.

mackysoft avatar Aug 03 '24 15:08 mackysoft