JaydenMaalouf / JoystickPlugin

Native Input Joystick Plugin for Unreal Engine 4/5
MIT License
34 stars 6 forks source link

Device configuration lost if device is not connected #49

Closed VitorOI closed 1 year ago

VitorOI commented 1 year ago

If I disconnect the device I configured, the Events do not appear on Editor Restart.

With Connected Device and Configuration set:

image

But if I disconnect the device, this happens:

image

With warning being: "InputAxisKey Event specifies invalid FKey'Joystick_TFlightHotasX_0_Axis0' for Joystick_TFlightHotasX_0_Axis0"

And if I search any input Event, they do not come up

image.

It seems the events depend on whether there's a configuration AND if the device is connected, but we don't want to be dependant on the device being connected or not. Plus, we have an array of Joysticks to use and configure and we can't have all of them connected at the same time.

I tried to replicate with two joysticks at the same time and the same happens: while both configured and connected, they work, but if I disconnect one of them, its events disappear

VitorOI commented 1 year ago

An update: turns out if I compile with the device connected, the event shows up again, which won't be a problem with Inputting on Input Actions. But for some reason I cannot seem to map any axis, only buttons

VitorOI commented 1 year ago

Okay, second and hopeful final update:

On my project, we have two possible pawns to control through two different player controllers and on the same device. In order to handle this, we had to override the Game Viewport Client and handle input to the correct pawn there using an overridable InputKey function.

What I noticed here with the plugin was that the Keys from the Joystick were being recognized by the First Pawn as well as the Second Pawn, but the Axis were only on the First pawn. This made me realize I needed to override the InputAxis function on the Game Viewport Client similar to the InputKey function in order to get them working and alas they do!

So finally the project is handling the input from the joystick correctly :D