The workflow for creating new menu entries is almost identical to that for creating new toolbar buttons, so this recipe will build on the previous one, and show you how to add the command created therein to a menu rather than a toolbar.
Create a new function in your
module
class:void AddMenuExtension(FMenuBuilder &builder) { FSlateIcon IconBrush = FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.ViewOptions", "LevelEditor.ViewOptions.Small"); builder.AddMenuEntry(FCookbookCommands::Get().MyButton); };
Find the following code within the
StartupModule
function:Extension = ToolbarExtender->AddToolBarExtension("Compile", EExtensionHook::Before, CommandList, FToolBarExtensionDelegate::CreateRaw(this, &FUE4CookbookEditorModule::AddToolbarExtension)); LevelEditorModule.GetToolBarExtensibilityManager()->AddExtender(ToolbarExtender);
Replace the preceding code with the following:
Extension = ToolbarExtender->AddMenuExtension("LevelEditor...