How to create functions called by hotkey in the editor?

I want to create functions that clone objects based on boundbox in the editor. These functions would be called by hotkeys and in the RMB menu.
How to create functions in C++ that were triggered using hotkeys? I have experience creating a new EdMode for the editor. But I can’t find information about using hotkeys.
Any information that will help me.

Hi Babush61,

Check out LevelEditorModule and its “Actions”:

	FLevelEditorModule& LevelEditorModule=FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
	FMyMenuCommands::Register();
	rdLevelEditorCommands=LevelEditorModule.GetGlobalLevelEditorActions();
	MyLevelEditorCommands->MapAction(FMyMenuCommands::Get().MyCommand,FExecuteAction::CreateRaw(this,&FMyTool::MyCommand));

void FMyMenuCommands::RegisterCommands() {

	UI_COMMAND(MyCommand,"My Command","A tooltip for my command",EUserInterfaceActionType::Button,FInputChord());
}

1 Like