How do you integrate a custom input device with the engine input and axis mappings?

After a bit of trial and error, I was able to add a custom FKey definition that shows up as an option in the action and axis mappings configuration within the editor. I did it directly in a game module, but I assume it wouldn’t be much different in a plugin. Here’s what I did:

Within my module’s header file:

struct EMyKeys
{
    static const FKey MyKeyX;
};

Within my module’s StartupModule function:

EKeys::AddKey(FKeyDetails(EMyKeys::MyKeyX, LOCTEXT("MyKeyX", "My Key X"), FKeyDetails::FloatAxis));

9500-mykey.png