Download

Detect if gamepad is plugged in? [exposed to blueprints preferably]

C++ isn’t my strong suit, but this doesn’t seem to be natively supported.

Basically I’d like to be able to tell if the user already has a gamepad plugged in at launch, and then expose than boolean to blueprints so I can trigger UMG changes (prompt the player to use corresponding buttons based on the input device).

I saw a few posts in the answerhub that claimed to be doing this, but I couldn’t make any of them work.

If I remember correctly, the shooter game example has c++ examples of dealing with if a controller is plugged in and events on what to do when it gets disconnected.

I launch a screen at startup that says, press gamepad start to use gamepad, or left mouse click for keyboard controllers. If the player presses the gamepad start button I switch a bool in the GameState class which the UMG classes then make changes on.

Gauntlet and some other games that are meant to be played with a gamepad on pc do it this way, so it seems accepted.

I’ll look into it, see what I can find. I’ve only got fairly simple C++ knowledge, but if I can find the code I should be able to understand it.

That was a method I hadn’t considered, it’s not as “seamless” as I had invisioned, but would work pretty well and would at least be a starting point for now. Thanks.

I can’t assume that because a player has a gamepad plugged in they want to use it, and my control scheme is very different if gamepad or keyboard, so the player has to choose. I guess, knowing if they had a gamepad plugged in would mean if they didn’t I could skip the screen.

Take a look at https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Engine/UGameViewportClient/index.html

More specifically look at the functions InputKey and InputAxis, which both have parameters that tell you whether or not the input came from a gamepad or not.
An option is to switch the control scheme if they press something on their gamepad and switch back if they press something on their keyboard/mouse.