- Home /
EditorGUI.Popup is showing the menu away from the button.
When I use "EditorGUI.Popup" it loads the menu in an awkward position. See:
I don't know how to fix this.
folderIndex = EditorGUI.Popup(new Rect(10, 0, position.width - 20, 32), folderIndex,FileNames(folders));
problem.png
(4.0 kB)
Comment
Well, which "rect" did you use? In most cases building GUI with the GUILayout components is way easier.
The menu is placed in the location defined by the rect. I see you are using the "position" variable to set the width of the rect, but NOT the location of the rect.(first two parameters) I suspect you will need to use the position to specify this location, rather than using the static numbers (10, 0).
Best Answer
Answer by Bunny83 · Apr 26, 2017 at 08:29 PM
Turn the "32" into a "16". The default GUI element height is 16 as far as i remember.
It's usually easier to use the EditorGUILayout elements which adjust their size automatically.