UInteractiveTool Keybinds

I’ve been trying to get Keybinds to work for a while now with my Plugin. So far, I’ve overridden the RegisterActions method in my UInteractiveTool subclass so the Action is registered and I’ve created a TInteractiveToolCommands subclass. I’ve also overridden the GetToolDefaultObjectList method where I’m adding the Class Default Objects of my UInteractiveTool subclass. The Documentation of the TInteractiveToolCommands ( TInteractiveToolCommands | Unreal Engine 5.6 Documentation | Epic Developer Community ) reads this:

  • in your EdMode Module, create a subclass-instance of this, say FMyToolCommands and call FMyToolCommands::Register() in your ::StartupModule() function

  • subclass must implement GetToolDefaultObjectList(), here you just add GetMutableDefault to the input list for all your Tools

  • add a member TSharedPtr UICommandList; to your EdMode impl

  • when you start a new Tool, call FMyToolCommands::Get().BindCommandsForCurrentTool(UICommandList, NewTool)

  • when you end a Tool, call FMyToolCommands::Get().UnbindActiveCommands()

  • in your EdModeImpl::InputKey override, call UICommandList->ProcessCommandBindings()

So far I’ve done everything I could, but I moved the FMyToolCommands::Get().BindCommandsForCurrentTool(UICommandList, NewTool) into the Setup() method of my UInteractive Tool subclass with the UnbindActiveCommands() in the shutdown, because I thought it might work, correct me please if there is a better way to do it.

But there is no InputKey method to override, since The EditorMode is a UEdMode subclass, not a FEdMode subclass, since that is what Unreal Engine generated when I created my plugin. Now I’m confused. What am I supposed to do to make the keybinds work? The Keybind shows up in the Editor, it just doesn’t call the Test Function that logs a string like it’s supposed to.

Just in case anyone is crazy enough to develop their own plugin like me, I did get it to work and it is fairly simple.

First of all, the documentation is either wrong or outdated. you neither add a TSharedPtr to the EditorMode subclass nor can you call the ProcessCommandBindings function, because there is no InputKey override on UEdMode subclasses. I formulated a guide how to actually do it:

One issue I have is I have no idea where Unreal handles user input in the framework. the ProcessCommandBindings function is called in quite a few places and seems to be in the Slate Viewport. I don’t know when and where that gets instantiated and how it calls the function in the first place. If anyone knows more, feel free to reply to this issue. Otherwise, these instructions will work.