Skip to content

Instantly share code, notes, and snippets.

View rms80's full-sized avatar

Ryan Schmidt rms80

View GitHub Profile
@rms80
rms80 / gist:622fd2fadd7fbecd2ab411fc7561d727
Created July 29, 2024 04:14
bit of code to add Mode Buttons to the Modes Toolbar in UE5 (to the right of Modes dropdown)
// grab some global stuff from the level editor
FLevelEditorModule& LevelEditorModule = FModuleManager::GetModuleChecked<FLevelEditorModule>("LevelEditor");
TSharedRef<FUICommandList> CommandBindings = LevelEditorModule.GetGlobalLevelEditorActions();
const FLevelEditorModesCommands& ModesCommands = LevelEditorModule.GetLevelEditorModesCommands();
FToolMenuOwnerScoped OwnerScoped(this); // not sure what this is for exactly, but other UToolMenu extenders do it
// hardcoded name for the modes toolbar, from FLevelEditorToolBar::RegisterLevelEditorToolBar()
UToolMenu* ModesToolbar = UToolMenus::Get()->ExtendMenu("LevelEditor.LevelEditorToolBar.ModesToolBar");
// add a new section