- Home /
I give up. My Foldout creates a very small space when expanded. How do I get rid of it?
Before and After picture:
You can see that when the Foldout is expanded, the content and arrow shift by a couple pixels. What is going on here, and how can I remove that or create a hot fix? It's bothering me, although obviously it doesn't break any functionality.
I've tried using automatic layout with EditorGUILayout.Foldout()
, and creating a rect with both GUILayoutUtility.GetRect()
and EditorGUILayout.GetControlRect()
then calling it by EditorGUI.Foldout()
.
To get the Toggle next to the Foldout, if I used EditorGUILayout.Foldout()
I called GUILayoutUtility.GetLastRect()
and indented it by ~15. If I used EditorGUI.Foldout()
, I already had a rect so I just indented that existing rect by ~15 and returned it to create whatever element I need after the Foldout arrow.
I'm about to just create my own Foldout element to get around this, but want to see if I'm missing anything obvious.
Thanks for any help.
Note: I mention that I indent the rect by ~15, but that doesn't change anything to do with the Foldout arrow spacing issue I'm having. The spacing still comes before the arrow, and indenting the rect affects the Toggle rect rather than the Foldout rect.
I've figured out a culprit. Removing the Box that I'm surrounding the Foldout with removes this issue. Now it's just a matter of figuring out why the Box causes the issue.
Your answer
Follow this Question
Related Questions
GetPropertyHeight infinite recursion on drawer 1 Answer
Can I name a game object's components (in the editor)? 2 Answers
What is the best way to draw icons in Unity's Hierarchy window? 1 Answer
Setting custom amount of space between elements in a custom inspector with EditorGUILayout ? 1 Answer
EditorGUI like light explorer window 1 Answer