I’m looking to poll all connected game pads for input, not just those that have a player controller linked to them.
The end goal is to allow players to join into the game by pressing the start button on their connected controller.
From what I’ve seen, any way of getting input only works if a controller is actively using that game pad for input, and also doesn’t return which game pad the input is coming from.
Okay, so I’ve figured this one out. You can hook into any input you want directly, by overriding the “InputKey” function of GameViewportClient.
My implementation looks like this (in .cpp):
bool UBB_GameViewportClient::InputKey(FViewport* InViewport, int32 ControllerId, FKey Key, EInputEvent EventType, float AmountDepressed, bool bGamepad)
// If it's a game pad, pressing the "Special Left" button aka the Back button on and Xbox gamepad.
if (bGamepad && EventType == EInputEvent::IE_Pressed && Key == EKeys::Gamepad_Special_Left)
// Do your code here. Make sure you return true if you use the input, so it will be consumed.
// If we haven't used input at this point, return super.
// Make sure to do this, because this is where it will send the input to your player controllers.
return Super::InputKey(Viewport, ControllerId, Key, EventType, AmountDepressed, bGamepad);
Thanks for posting this! I can confirm this works in 4.7