UI Elements
Menu Bar
A row of buttons that open context menus
Overview
Menu Bar builds a set of menu buttons and connects each one to a Context Menu. It can regenerate its items in Edit Mode as well as at runtime.
Usage
Add the Menu Bar component to a UI object or create a Menu Bar prefab via Evo UI -> Create.
Populate Items, including each label and context-menu content.
Assign the button and context-menu presets.
Enable Open Menu On Hover if menus should respond to pointer hover.
Customization
- Edit the item preset for button appearance and the context-menu preset for menu layout and animation.
- Item Menu Offset positions each menu relative to its button.
Public API
Use MenuBar in the Evo.UI namespace.
Call Refresh() after editing the item list. Generated views are available through each item’s GeneratedButton and GeneratedMenu.
Properties
| Name | Type | Description |
|---|---|---|
IsOpen | bool | Whether a bar item has an open menu. |
Fields
| Name | Type | Description |
|---|---|---|
items | List<Item> | MenuBar.Item definitions. |
openMenuOnHover | bool | Enables hover opening. |
blockUIWhileOpen | bool | Blocks other UI while a menu is open. |
Methods
| Name | Parameters | Description |
|---|---|---|
Refresh() | None | Generates or refreshes the menu buttons. |
OpenMenu() | Item targetItem | Opens the specified Item. |
CloseMenu() | None | Closes the active menu. |
GetItem() | string label | Finds an Item by its label. Returns Item. |
Example
using UnityEngine;
using Evo.UI;
public class MenuBarExample : MonoBehaviour
{
[SerializeField] private MenuBar target;
private void Start()
{
target.Refresh();
var fileMenu = target.GetItem("File");
if (fileMenu != null)
target.OpenMenu(fileMenu);
}
}