How do I Get the Gamepad Device Name (Xbox, PS4, etc)

Hello!
I’ve been trying to figure out how to get the gamepad device name for awhile now. It doesn’t seem like anyone has any concrete answers besides “You can do it in C++”.

I’d like to detect what type of controller is connected so that I can show specific input UI to represent the respective gamepad device. However, it doesn’t seem like UE4 makes this easy.

According to some sources I found, FInputDeviceScope seems to include the information I need, but whenever I call the static FInputDeviceScope::GetCurrent() function, it returns a nullptr. I’m not sure how this is supposed to be used.

I’m not asking anyone to program it for me, I’d just like some help understanding where and what I’m supposed to hook into in order to get the device names of the controllers for each player.

Thanks!

Sigh, always find a well-worded question on the same problem I have with no answers :frowning:

I was able to get the gamepad name with Unity, to detect if mouse and keyboard/playstation/xbox, but I’m also struggling to find out how to replicate that in Unreal.

It really feels like this should be basic functionality of a game engine by now???

Yeah, this seems to be a frequently asked question that no one ever seems to answer.

Unity definitely makes the process easier. The only way I’ve been able to reliably get gamepad information in UE4 is by loading a newer version of SDL2 which has functionality to read gamepad info.

This forum post helped quite a bit. However, it’s still a process to get it working, and it’s not inherently clear how to load a library – or if this is even the proper way to handle this (having 2 versions of SDL2 running at once feels very strange to me).

I would very much like to see Epic add an official way to read gamepad info, but as far as I can tell there’s no way to do it.

EDIT: After doing a bit of research, it appears that this plugin does the exact same thing as I described above, albeit in a way better way than I implemented it in my own project haha. Judging by this documentation I found for it, it seems like it should include a way to get the device info we need in order to check what type of controller is being used.

Hey guys, I figured it out for the most part and you can check out my solution in this Reddit post! Feel free to reach out for help!

I have not tested this solution yet, but considering this is definitely the most robust answer I’ve seen on the entire internet, I think it deserves to be marked as correct haha. Thank you very much!

My pleasure! There’s room for improvement with the way I went about it for sure, but it’s better than nothing! XD