Draws an editor window with a menu tree.

namespace Sirenix.OdinInspector.Editor
public abstract class OdinMenuEditorWindow : OdinEditorWindow


Namespace: Sirenix.OdinInspector.Editor
Assembly: Sirenix.OdinInspector

See Also


Return Type Definition Description
Func<OdinMenuItem, bool> CustomSearchFunction Gets or sets the custom search function.
bool DrawMenuSearchBar Gets or sets a value indicating whether to draw the menu search bar.
OdinMenuTree MenuTree Gets the menu tree.
float MenuWidth Gets or sets the width of the menu.
bool ResizableMenuWidth Gets a value indicating whether the menu is resizable.


Return Type Definition Description
OdinMenuTree BuildMenuTree() Builds the menu tree.
void DrawMenu() The method that draws the menu.
void ForceMenuTreeRebuild() Forces the menu tree rebuild.
IEnumerable<Object> GetTargets() Draws the menu tree selection.
void OnDestroy() Called when the window is destroyed. Remember to call base.OnDestroy();
void OnGUI() Draws the Odin Editor Window.
void TrySelectMenuItemWithObject(Object) Tries to select the menu item with the specified object.


public class OdinMenuEditorWindowExample : OdinMenuEditorWindow
    [SerializeField, HideLabel]
    private SomeData someData = new SomeData();

    protected override OdinMenuTree BuildMenuTree()
        OdinMenuTree tree = new OdinMenuTree(supportsMultiSelect: true)
            { "Home",                           this,                           EditorIcons.House       }, // draws the someDataField in this case.
            { "Odin Settings",                  null,                           EditorIcons.SettingsCog },
            { "Odin Settings/Color Palettes",   ColorPaletteManager.Instance,   EditorIcons.EyeDropper  },
            { "Odin Settings/AOT Generation",   AOTGenerationConfig.Instance,   EditorIcons.SmartPhone  },
            { "Camera current",                 Camera.current                                          },
            { "Some Class",                     this.someData                                           }

        tree.AddAllAssetsAtPath("More Odin Settings", SirenixAssetPaths.OdinEditorConfigsPath, typeof(ScriptableObject), true)

        tree.AddAssetAtPath("Odin Getting Started", SirenixAssetPaths.SirenixPluginPath + "Getting Started With Odin.asset");

        var customMenuItem = new OdinMenuItem(tree, "Menu Style", tree.DefaultMenuStyle);
        tree.MenuItems.Insert(2, customMenuItem);

        tree.Add("Menu/Items/Are/Created/As/Needed", new GUIContent());
        tree.Add("Menu/Items/Are/Created", new GUIContent("And can be overridden"));

        // As you can see, Odin provides a few ways to quickly add editors / objects to your menu tree.
        // The API also gives you full control over the selection, etc..
        // Make sure to check out the API Documentation for OdinMenuEditorWindow, OdinMenuTree and OdinMenuItem for more information on what you can do!

        return tree;