SDL2InputDevice: Simple Direct-Media Layer 2.0 API for Joystick & Controller Support [UPDATED 1.1]


SDL2InputDevice provides a new UE4 input device that utilizes the Simple DirectMedia Layer (SDL2) library. This device can then be used to access or provide more advanced functionality than what is available in the engine by default. It was designed from the start to be as transparent to UE4 as possible. SDL2InputDevice is as its namesake suggests a new input device. This solution means that input is passed into the various game systems of UE4 through the existing input pipeline. With SDL2InputDevice, there is no need for hacky blueprint glue code or special processing

Marketplace Link:…d2b133e777a5e6


  • Low level joystick and Game Controller support including all of the SDL2 Game Controller mappings
  • Supports more than 4 controllers in a single session
  • Utilizes the the existing UE4 input subsystem

Code Modules: (Please include a full list of each Plugin module and their module type (Runtime, Editor etc.))

  • SDL2InputDevice

Number of Blueprints: 1 Blueprint Function Library with 9 functions

Number of C++ Classes: 2

Network Replicated: Yes

Supported Development Platforms: Win32, Win64

Supported Target Build Platforms: Win32, Win64

Example Projects: JoeWilcox-WisEngineering (Joe Wilcox) · GitHub

Version 1.1 Now Available


  • Added 4.24 and 4.26 support
  • Fixed a crash due to not handling the center position of the hat on a joystick
  • Reorganized the input binds to start a 0 instead of 1
  • Fixed RawSDL2Input binds showing up as Keyboard
  • Fixed a possible crash if the plugin can’t convert an SDL key to a UE4 key
  • Moved some logging to VeryVerbose
  • Added a dead zone for SDL axis devices
  • Fixed hat direction not being properly tracked in all cases

I got my hands on the new xbox series x controller and it crashes the project when pressing its xbox button (using the example project)

Sorry about that. It’s a left over bug from when I pulled the code out of the project it was originally used it. The system button doesn’t have a UE4 GamepdKey equivalent because typically the OS doesn’t pass that through. If you are familar with C++ you can apply a quick fix by making the following change to FSDL2InputDevice::GameControllerButton() in SDL2InputDevice.cpp:


FName UE4KeyName = SDL_GameControllerConversionTable.Contains(ButtonID) ? SDL_GameControllerConversionTable[ButtonID] : NAME_None;


FName UE4KeyName = SDL_GameControllerConversionTable.Contains(ButtonID) ? SDL_GameControllerConversionTable[ButtonID] : NAME_None;
if (UE4KeyName == NAME_None) return;

That will quick out if there isn’t a translation key. If you’re blueprint only, I’ll try to push a new version as quick as I can.

We have released version 1.1. This has some critical bug fixes that you’ll want if you are trying to use the plugin for non-game controller support. I’ve also released a new example project to our github page that is more flight-stick focused.

How do I uh… use a t16000m with this? I downloaded and installed the plugin, then tried using your flight stick demo and I was told by Unreal that the 4.25.3 is incompatible with the uproject file.

Is just want to rotate a cube using the flight stick at this point.

Cannot copy while packing

Failed to copy D:\hoevo_vehicle\Hoevo_Vehicle\Plugins\SDL2InputDevice\GameControllerDatabase\SDLControllerMappings.dat to D:\hoevo_vehicle\Hoevo_Vehicle\Saved\StagedBuilds\WindowsNoEditor\Hoevo_Vehicle\Plugins\SDL2InputDevice\GameControllerDatabase\SDLControllerMappings.dat

I just tested the plugin with 4.25.4 which is the last 4.25 version and it worked fine. You can try changing the “EngineVersion” value in the uplugin to just 4.25 and see if it clears up the notice. As for how to use it with a t16000m it should just work with RawInput. Check the examples.

@qtdshwg what engine version and I assume you’re using the latest build?

Hmmm. Couldn’t get it working. I tried axis 0 - 7, got nothing. Maybe I’m missing something…

Hello, I have the same problem on version 4.26.2.
I have to manually create the GameControllerDatabase folder under SDL2InputDevice and put SDLControllerMappings.dat into it to package successfully.

This is a bug. I’ll release a 1.2 patch shortly but in the meanwhile, in the file SDL2InputDevice.Build.cs at the very end of the file, you can see where I added the dependency. I remove that file in 1.1 but forgot to remove the dependency. Just remove this section:

			// Add a dependancy for the Controller Database.  NOTE: SDL2 has a default GameController compiled in, but this was we can
			// add things without having to recompilee.
			string ControllerDatabasePath = Path.Combine(PluginDirectory, "GameControllerDatabase", "SDLControllerMappings.dat");

That should fix packaging. Sorry about that.

Hi, Recently I tried to package the XSX platform,I got an error in the log,It seems that the test is ok before replying to you on August 4th,Now there is an error, can you help fix it?

I tried to use the plug-in in XSX back in August and didn’t make any mistakes.

[2021.09.09-05.14.12:994][ 0]LogStreaming: Error: Couldn’t find file for package /Script/SDL2InputDevice requested by async loading code. NameToLoad: /Script/SDL2InputDevice
[2021.09.09-05.14.12:994][ 0]LogStreaming: Error: Found 1 dependent packages…
[2021.09.09-05.14.12:994][ 0]LogStreaming: Error: /Game/SDL2InputDevice/bpGameMode

feel free to reach out to me via email (i’ve DM my address). The only supported platforms are Windows 32/64bit but I’m happy to help you try and get it working on a different platform.


Maybe I missed something, but I am not able to create SDL Preview Key or other SDL events in the blueprint. all of them appearing as messages, In 4.24, 4.25, 4.26, Copying from the Example project creating custom event.

In the example project is working fine.

Any ideas?

Thank You

Have you plans to support Android too? I ask because it could be a game changer on Oculus Quest!

Hi there,

so I’m trying to get my DS4 controller to work. I created a custom GameViewportClient class and like you said in the documentation, I receive duplicate input events one from XInput and another from SDL as expected.

I log the controller ID that I get from that input event, first one is 0 and another is 10 or 11 or 12 (depending).

In the doc it says to use the SetControllerID function on LocalPlayer, but when I do SetControllerID(10) or 11 or 12 etc anything other than 0, I lose all input and nothing works including keyboard!

What am I doing wrong? do I need to do something else?

You are not doing anything wrong. You’re setting the default player controller’s ControllerID to 10 which causes keyboard input (which is always ControllerId 0) to be ignored at that player controller. This is a side-effect of trying to exist peacefully with the default input system. How you deal with this depends on your game. If you’re game is controller focused, then just utilize the first player controller as sort of a menu player controller that manages input for the UI. If it’s a mixed game (like say a flight-sim) then you probably want to flip it and have a new Joystick PlayerController that funnels input back to the main game player controller.

Or you can adjust the plugin to hijack existing controller ids instead of co-existing with them. It would be pretty easy to do. If you go this route and have trouble, go a head an PM me and I’ll try and help you get it worked out.

Hmm, interesting idea. Can you even pair or connect a controller to the Quest? I have a Q2 here so maybe I’ll give it a go over the holiday and see what’s what.

Did you register the actor you are using here as a Previewer? There is a function SDL Register Previewer:


You’ll also need to make sure the actor that is receiving these events implements the SDL2Key Notification Interface. Once you do that, the SDL Preview Input Key event should become available to you.

Do you have a Mac build? I read in the Questions section to reach out to you for a Mac build in order to test it. I’m not the one who asked the original question, but I’d really like to see if this works since I’m developing on a Mac.