Does UI_COMMAND work in a game?

I managed to make a custom menu bar using FMenuBarBuilder, and to place the menu bar as a UMG widget through UNativeWidgetHost.
The problem is that any shortcut key initialized by UI_COMMAND does not seem to work in the game.
Does UI_COMMAND only work in the UE4 editor?
Is there any way to enable the shortcut keys in a (packaged) game?

I’ve found that for editor shortcut keys,

LevelEditorModule.GetGlobalLevelEditorActions()->Append(PluginCommands.ToSharedRef());

is required,

https://answers.unrealengine.com/questions/677093/view.html

but I could not find the similar function in FDefaultGameModuleImpl. Is there any function to append UI_COMMANDs to a project’s module?

Thank you.

There might be much simpler and better solution, but I found a solution.

1 Create a custom UGameViewportClient via File → New C++ Class…

2 Override InputKey function as follows for example. In this case, UI_COMMANDs have been included in TSharedRef command_list.

bool UCustomGameViewportClient::InputKey(const FInputKeyEventArgs& EventArgs) {
  if (EventArgs.Event == EInputEvent::IE_Pressed) {
    const uint32* character_code_ptr;
    const uint32* key_code_ptr;
    FInputKeyManager::Get().GetCodesFromKey(EventArgs.Key, character_code_ptr, key_code_ptr);
    const uint32 character_code = (character_code_ptr != nullptr ? *character_code_ptr : 0);
    const uint32 key_code = (key_code_ptr != nullptr ? *key_code_ptr : 0);
    const bool ret = UNativeWidgetHostTestMenu::GetCommandList()->ProcessCommandBindings(FKeyEvent(EventArgs.Key, FSlateApplication::Get().GetModifierKeys(), FSlateApplication::Get().GetUserIndexForKeyboard(), false, character_code, key_code));
    if (ret) {
      return true;
    }
  }
  return UGameViewportClient::InputKey(EventArgs);
}

3 Set the custom UGameViewportClient by Project Settings → Engine → General Settings → Default Classes → Game Viewport Client Class.