[4.7.5] Cannot process input events of additional gamepads anymore

I used to be able to process input events of all attached input devices by deriving from UGameViewportClient and overriding methods such as InputKey(). If a user pressed “Start” on an attached gamepad I would create a player for that user for local coop gameplay.

Since 4.7 it seems events are already being filtered within the Slate Application class and are not passed to the Game Viewport Client.

So how can I get hold of input events of devices not yet being assigned to a player?

Marc

I am using a different approach now but that has its shortcomings, too:

I subclassed the Analog Cursor that gets all events beforehand. But within the HandleKeyUpEvent method I am having a hard time creating a new player. For one thing there is no access to any “world” or “worldcontextobject”. I am now setting a World pointer from the outside every frame which is ugly. For another thing I need a “controller id” to create a player. However the InKeyEvent only provides a “user index”. There are no global conversion functions available. I am using the user index as the controller id for now because in UE 4.7 they are always the same but is probably going to change in the future - according to source code comments…

So what is the correct / intended way to handle this use case?

Marc

Hey mkamradt-

Just so I understand, is the problem that multiple gamepads don’t receive any of your input commands? If so does the first player gamepad receive input? Could you post the code that you use that used to work as well as the code you have now?

Cheers

Hey ,

Maybe this explains it better:

What I want to achieve:

• Two gamepads are connected to the PC / Console
• Player One is created by default, is connected to gamepad one and can use the menu and start gameplay
• Another user can press “Start” on the second gamepad to create Player Two to join for local coop

The basic problem:

• Input events (such as “Press Start”) are not routed to UMG or other easily available global objects if the gamepad is not associated with an already created player

Technically this was possible in 4.6 using the following method:

• Subclass UGameViewportClient and override methods such as InputKey()
• UGameViewportClient gets all input events from all input devices regardless of created players
• If “Start” is pressed, create a new player for that controller
• All necessary data is available (World Context, Controller Id)

For 4.7 the input events are not routed to UGameViewportClient anymore, so the only work-around I found so far is this:

• Subclass IInputProcessor / FAnalogCursor and override methods such as HandleKeyDownEvent()
• IInputProcessor gets all input events from all input devices regardless of created players
• If “Start” is pressed, create a new player for that controller
• However the World (or World Context Object) in not available at that time and neither is the Controller Id
• The input event holds a “User Index” that relates to a Controller Id however there are no function convert back and forth between them

Marc

Hey mkamradt-

I’ve entered a feature request to include input from a device without the creating the character (UE-14833). This would make it easier for multiple player to join a game already in session.

Cheers

Hi,

I have the same problem in 4.10

Did any one found solution?

Thanks

The solution I mentioned is still valid: Subclass IInputProcessor, give it a pointer to the world, override the input related methods, create a player if “start” or whatever is pressed. I used this technique in a 4.8 and a 4.10 based project.

Marc

Than you mkamradt

I just was wondering if any other solution aper seance 4.7, but I didn’t noticed it.

I will try your way then