Context Menu
ContextMenu
component and ContextMenu
template. Different menus can use the same template.ContextMenu
component.Options
Interactable
bool
Allow users interact with the ListView.
Template
ContextMenuTemplate
Context menu template.
MenuItems
ObservableList<MenuItem>
Menu items.
Is Default
bool
Is default menu? Default menu will be opened on context menu key press.
Navigation
bool
Enable keyboard and gamepad navigation.
Open On Right Button Click
bool
Open context menu on right mouse button click.
Open On Context Menu Key
bool
Open context menu on context menu key press.
Submenu Delay
float
Delay before open and close sub menu.
Unscaled Time
bool
Use unscaled time.
MenuItem Options
Visible
bool
Is item visible?
Interactable
bool
Is item interactable?
Icon
Sprite
Icon.
Checked
bool
Is item checked?
Name
string
Name.
HotKey
HotKey
HotKey can be enabled with
MenuItem.EnableHotKey()
even if item not used in menu (Supported only of InputSystem enabled).Action
UnityEvent<MenuItem>
Action on item click.
Items
ObservableList<MenuItem>
Nested items.
Events
OnOpen
UnityEvent<ContextMenu>
The event raised when context menu opened.
Arguments: opened context menu.
OnClose
UnityEvent<ContextMenu>
The event raised when context menu closed.
Arguments: closed context menu.
OnItemSelect
UnityEvent<MenuItem>
The event raised when menu item selected.
Arguments: selected menu item.
OnItemDeselect
UnityEvent<ContextMenu>
The event raised when menu item deselected.
Arguments: selected menu item.
ContextMenu for non-UI Gameobjects
OpenContextMenu
component with the ContextMenu
reference to a non-UI game object and the menu will be opened on the right mouse button click.contextMenu.Open(eventData);