Download

How do I Detect Number of Gamepads for Local Multiplayer?

Ok so before I get started I just want to say I know very little about C++, especially in context of Unreal, and I am upset that I even NEED to use it for what seems to me should be a pretty simple and easy thing to check. Thank you in advance for your patience.

Long story short, I’m working on a 2-player local multiplayer game and by default, It seems I can either assign gamepad to player 1, or skip assigning gamepad to player 1. Since I only have one gamepad that seems to work with Unreal Engine, I’ve been doing all my testing with Skip Player 1 set to true. However, since many people DO have 2 gamepads and should be able to use them both if they wish, I’d like to be able to check and see if there’s a second gamepad plugged in and if so, deactivate Skip Player 1, or if that’s a bad idea, reassign the gamepads.

I’ve looked through a lot of solutions online, but I am really not even sure what I’m supposed to be looking FOR. I’ve gathered that perhaps I’m supposed to use FCoreDelegates::OnControllerConnectionChange, but for what? I do not know for sure.

Any advice would be appreciated.

Ok so I found a solution and it WAS a Blueprint solution. Not a GREAT one, I’m sure, but I will not be picky right now. I posted the details on Reddit, you can see what I did here: https://www.reddit.com/r/unrealengine/comments/jgc0j5/working_on_a_local_multiplayer_game_and_need_a/

@Dnallohleoj

That hack doesn’t seem too robust tbh. Instead I’d look to the free Plugins by LowEntry or Rama to see if there’s anything there (LowEntry did add some helpers for Split-Screen a while back). Plus Lowentry accepts suggestions occasionally.:wink: Maybe try DM / PM…:cool:

Thanks for pointing out LE. That’s a plugin I DO need to learn. But in the meantime I have been refining the solution I found and I think it’ll be sufficient for what I’m trying to do. I knew it was a hack when I went in, but I’m low on time and need to move on if it isn’t causing problems, which it doesn’t seem to be doing at this time.

To anyone who came to this, like, looking for help, though, if you don’t need a quick functionality hack and have time to explore LE’s library, here it is. LE Extended Standard Library in Code Plugins - UE Marketplace you should totally let me know if it can detect number of gamepads!