Unreal Editor: adding a custom menu
Extending the editor with a menu
Adding a new option in the menus in unreal engine
In the module add for example to add to tools:
Extending Menus: Step-by-Step Guide
1. Setting Up
Start by preparing your module to modify the Unreal Editor's menus during its initialization phase. This ensures that your customizations are loaded correctly when the editor starts.
#include "ToolMenus.h"
void MyModule::StartupModule()
{
UToolMenus::RegisterStartupCallback(FSimpleMulticastDelegate::FDelegate::CreateRaw(this, &MyModule::RegisterMenus));
}
void MyModule::ShutdownModule()
{
UToolMenus::UnRegisterStartupCallback(this);
UToolMenus::UnregisterOwner(this);
}
void MyModule::RegisterMenus()
{
FToolMenuOwnerScoped OwnerScoped(this);
// Menu extension logic goes here...
}Extra Info for this section
Overview of UToolMenus
UToolMenus is a subsystem in Unreal Engine designed to manage UI menus and toolbars throughout the Editor. It allows you to modify existing menus or add new items dynamically, supporting a wide range of customization.
Extending Menus in Unreal Editor
Regarding extending menus in Unreal Editor, the UToolMenus class allows plugins to insert their custom menu items into various parts of the editor's UI. Here's a list of some common menu locations you can extend:
LevelEditor.MainMenu: The main menu bar at the top of the Level Editor.
File: Related to file operations (new, open, save).
Edit: Related to editing operations (undo, redo, cut, copy, paste).
View: Related to the viewport configurations and other view options.
Window: Related to the various windows and panels that can be opened.
Tools: Typically used for tools related to development and utilities.
Help: Provides help links, documentation, and other resources.
LevelEditor.Toolbar: The main toolbar in the Level Editor.
Settings: Where settings and preferences can be accessed.
Viewport: Specific tools related to the viewport.
AssetEditor: Menus specific to asset types like Material Editor, Animation Editor, etc.
Common Menu Locations and How to Extend Them
LevelEditor.MainMenu
This is the main menu bar at the top of the Level Editor. Here's how to add a new tool under the "Tools" menu:
LevelEditor.Toolbar
For adding items to the main toolbar:
AssetEditor Menus
For asset-specific editors like Material Editor or Animation Editor:
Tips for Effective Menu Integration
Localization: Use
LOCTEXTfor labels and tooltips to support localization.Iconography: Ensure that you provide clear, understandable icons for your menu items. This improves the UX and makes your tools easily recognizable.
Testing: Always test your menu additions across different configurations and ensure that they do not interfere with existing functionalities.
Documentation: Provide clear documentation for your plugin's users, explaining what each menu item does, especially if the functionality isn't immediately obvious.
Last updated