I am trying to write plugin that I intend to use across multiple projects and I want to group all the toolbar buttons I have into a single block with an additional menu item similar to how the play/stop section is.
So far I can make toolbar buttons and bind functions to them no problem. But when I try to add an menu to that button I can’t get it to work. I assumed that I would be using the AddSubMenu() function that is part of the FToolMenuEntry object, but it appears to not work as I intended.
When looking for examples online the only ones I could find were from several years ago the syntax seems to have changed. When I tried to replicate them I get compilation errors related to lvalues.
Has anyone done this themselves or know of a decent up to date example I can learn from?
My RegisterMenus() function:
void FBuildingGenModule::RegisterMenus()
{
// Owner will be used for cleanup in call to UToolMenus::UnregisterOwner
FToolMenuOwnerScoped OwnerScoped(this);
FToolMenuSection& Section = UToolMenus::Get()->ExtendMenu("LevelEditor.LevelEditorToolBar.PlayToolBar")->FindOrAddSection("WorldGen");
FToolMenuEntry& Menu = Section.AddEntry(FToolMenuEntry::InitToolBarButton(FBuildingGenCommands::Get().BuildingGenMenu));
FToolMenuEntry& MenuEntry = Section.AddSubMenu(FName(TEXT("Hello There")),
FText::FromString("Label"),
FText::FromString("ToolTip"),
FNewToolMenuChoice(),
FToolUIActionChoice(FExecuteAction::CreateRaw(this, &FBuildingGenModule::PluginButtonClicked)),
EUserInterfaceActionType::Button);
Menu.SetCommandList(PluginCommands);
MenuEntry.SetCommandList(PluginCommands);
}
Any help is appreciated, thanks in advanced.