Can't get a simple drop-down menu to work

Hi all,

I am trying to create a simple UI with a menu bar on top and the main content (scrollview) below. Both is attached to a canvas with a VerticalLayoutGroup.
When clicking on on a button in the menu bar, I am displaying a dropdown menu with additional buttons, but so far this one was always displayed behind the main content, because the menubar (and thus everything belonging to it) was in the canvas hierarchy behind the main content.
However I cannot change this because it would change the order in the VerticalLayoutGroup and the menu bar would be displayed on the bottom.
After lots of research and different tries (changing the z value of the dropdown menu etc.), it seemed like I found the solution: adding a canvas component to the dropdown menu, overwriting the order and giving it another sorting layer. So now the dropdown menu is indeed displayed in front, however when trying to click one of the buttons, I instead click through them and actually end up clicking on the buttons of the main content view in the background.

Here a screenshot to illustrate what I mean:

3394998--267018--screenshot.JPG

Instead of clicking on “Map” I end up clicking on the big button in the background.

Any ideas what I could do?

PS: I just realized it’s not really a Scripting question but rather a UI/2D one, sorry for the wrong sub-forum…

I would create one panel. Inside that I would put the menu to display on top and another panel where it would be the main content with the VerticalLayoutGroup.

Thanks for your answer, but I’m not entirely sure what you mean.
Currently the scene looks like this:
I have the drop down menu as a panel below the MenuButton (which is part of the MenuBarPanel). MenuBarPanel and ContentScrollView are part of the VerticalLayoutGroup of the mother canvas “meinCanvas”.
3395261--267079--screenshot.JPG

What exactly would you suggest to change in this setup?

I think they were suggesting that you keep the vertical layout group on the content of your scroll view, rather than on your canvas.

That worked, thanks guys!

1 Like

Cool :slight_smile: