System.Action<Menu> ContextMenu

book_4_sparkGenerated
code_blocksInput

Description

The ContextMenu field in the Editor.InspectorHeader class is a public instance field of type System.Action<Editor.Menu>. It is used to define a context menu for the inspector header, allowing developers to specify custom actions that can be executed when the context menu is invoked.

Usage

To use the ContextMenu field, assign it a delegate or lambda expression that takes an Editor.Menu as a parameter. This delegate will be called when the context menu is triggered, allowing you to populate the menu with custom items.

Example

// Example of setting up a context menu for an InspectorHeader
InspectorHeader header = new InspectorHeader();
header.ContextMenu = menu =>
{
    menu.AddItem("Refresh", () => { /* Refresh action */ });
    menu.AddItem("Settings", () => { /* Open settings action */ });
};