Search Issue Tracker
By Design
Votes
0
Found in
2022.3.59f1
6000.0.40f1
6000.1.0b8
6000.2.0a5
6000.3.0a1
Issue ID
UUM-98307
Regression
No
EditorGUILayout.PropertyField foldout icon inside Vertical Layout Group has an incorrect indent when used with OnInspectorGUI()
Reproduction steps:
1. Open the attached “IN-95640.zip” project
2. Open the “SampleScene”
3. From the Hierarchy, select the “Test” GameObject
4. Observe the “Test Component Bug (Script)” Component in the Inspector
Expected result: The foldout icon is inside the “Box” container and is correctly indented
Actual result: The foldout icon is indented not correctly and is outside of the “Box” container
Reproducible with: 2022.3.59f1, 6000.0.40f1, 6000.1.0b8, 6000.2.0a5
Reproducible on: Windows 11
Not reproducible on: No other environment tested
Note:
- The expected result can be seen in the “Test Component Working (Script)” Component, which uses “CreateInspectorGUI()”
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Memory leak occurs when focused on Player while using Direct3D12
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
- Frame Debugger displays incorrect output when FidelityFX Super Resolution or Spatial-Temporal Upscaler is used with Temporal Anti-aliasing or Subpixel Morphological Anti-aliasing
Resolution Note:
When you use OnInspectorGUI in your editor, we know you are working with IMGUI code. Internally, we create an IMGUIContainer and wrap your IMGUI calls with additional setup and teardown code to ensure the IMGUI state aligns with the inspector. However, when you use CreateInspectorGUI, we expect UI Toolkit elements to be returned. In this case, IMGUIContainer does not have the necessary context to recognize it is part of the inspector, so it defaults to standard values.
For this specific use case (the foldout issue), it can be fixed by setting EditorGUIUtility.hierarchyMode = true. Alternatively, a workaround would be to use two InspectorElement instances: one for UI Toolkit elements and another to handle the IMGUI drawing. This approach allows you to keep the responsibilities of each framework separate while avoiding the context mismatch.
Unfortunately, it is challenging for us to change this behaviour now, as it would almost certainly break existing editor tools that have been written around the current behaviour.