---
title: "Main Menu"
---
In Class: `BP_MainMenu`

The main menu is composed of several widget components in 3D-Space. The Widget Index defines the depth of the menu, e.g. the widget showing the Audio Settings Widget is accessed from Settings (from Main at Index 0) -> Audio (from Settings at Index -1) -> Audio Widget (at Index -2). Opening a new Menu causes all Widget Indices to increment. Widget with an Index lower than 0 gets collapsed, Widgets with an Index greater 0 get disabled and only at Index 0, the Widget is enabled. On disabled widgets, the last pressed button is altered visually which also gets reset at Index 0.

All Widget Buttons inherit from the same widget class implementing an enum to save the button function. The button actions are centralized by binding to a custom event dispatcher on the click event, passing the enum to the BP_MainMenu. From there, we can switch on enum and handle the respective functionality. The main thing we need to do manually is running the UpdateIndices Function to increment and making the correct Widget visible (we can't do this automatically as there are multiple Widgets with the same Index).







```{=html}
<iframe width="100%" height="500" src="https://blueprintue.com/render/-azlwrm2/" scrolling="no" allowfullscreen></iframe>
```