So I’m just tidying up one of my editor interfaces and I wanted the button used to pop up a generic menu to match the style used by Unity for it’s drop down menus in the inspector. i.e with an up and down arrow to the right.
I’m not using EditorGUILayout.Popup because I don’t want to add a delay whenever the inspector is shown which would occur if I created the array of options in OnEnable or OnInspectorGUI. Instead I wish to populate the menu when/if the user clicks the drop down button, at which point in my example I scan the project’s path for scene files.
To use call EdDelayedPopup.Popup and pass it the string or GUIContent you wish to display in the button and a function to call when the button is pressed. When the function is called you can query EdDelayedPopup.ButtonRect to get the rectangle of the button and GenericMenu.DropDown to open a menu there or even use your own custom window.
Continue reading Custom popups matching EditorGUILayout.Popup style