Download

Setting up ControllerID Controller for DebugCreatePlayer?

In the console in my project, I can successfully create another play using “DebugCreatePlayer 1” - I understand this gives the pawn the controls set to controllerID1 but how can I set up Controller 1? I want to have two players, one with an Xbox Controller (Main Character) and one with a Keyboard, but I can’t seem to find the options of defining the controller for ControllerID1. Is there anything I can refer to about setting up ControllerID?

There isn’t a really great way of splitting the keyboard and controller input to two different player controllers right now. If I were going to try and do it with the current set up, I would probably look at the UGameViewportClient InputKey and InputAxis functions. We already kind of do something similar for handling the multiple PIE windows when doing multiplayer testing in the editor.

So, I think what I would do is subclass UGameViewportClient (you can specify using GameViewportClientClass in the project settings which to use), override the InputKey and Axis functions and do a if (Key.IsGamepadKey()) check and change what ControllerId to send the input to.

Let me know if you have any further questions on that.

Is there any plans down the line to support multiple Xbox Controllers on one machine?

Multiple xbox controllers on one machine already works. I have two connected to my machine and when you do CreateDebugPlayer 1 the second controller should immediately begin controlling that new player.

Oh awesome. I didn’t realise. So in theory, Keyboard and Mouse + Controller would need the workaround you suggested whereas two controller would work out the box?