I am having an issue with my menu controls (main menu and pause menu), where only for the D-pad navigation do I need to first click in the window before the events start registering. What is strange to me is the left thumbstick registers immediately without needing to press. The D-pad event is being registered off the player controller and using the “Was input key just pressed node” that is fired from the event tick:
I tried various combinations of focus of “UI + Game mode” and setting the menu itself to focused and none seem to capture the input such that the D-pad can immediately start firing events
Hmmm after reading this article, “Set Game Mode Only” was actually what I wanted and worked as expected with the game pad. Though capturing mouse down true/false as suggested here has no effect on fixing the “Double click” problem noted: Problem with Set Input Mode Game Only node - Superyateam Gamedev
At least now things are playable as before the D-pad would not register at all in the menus if only a gamepad was available.
Unfortunately the game pad isn’t work with “UI only”. I was able to achieve the desired effect using “Game only” and then had a highlighting glitch on the pause menu when a controller wasn’t connected and a mouse was used which I was able to resolve by detecting when a gamepad was connected. I used a combination of GenericApplication::IsGamepadAvailable to detect if the game was launched with a controller connected and then monitor if the controller gets unplugged during gameplay using FCoreDelegates using a UGameInstance. The game instance was a new concept for me that I haven’t seen before and looks to be a place to track global state that cuts across multiple games (instead of using GameState or PlayerState) and acts as an entry point for the game.
auto genericApplication = FSlateApplication::Get().GetPlatformApplication();
bGamepadAvailable = genericApplication.IsValid() && genericApplication->IsGamepadAttached();
I’ve seen in most AAA games that are played on PC with gamepad support, you are asked to either push a key or press “A” and by selecting that first input method it initially sets the default control input. In my case, simply allowing either suffices.