[Lyra] Input from multiple gamepads

In Lyra, input is received from multiple gamepads and, for the life of me, I can’t figure out how, been at it for 3 days now. To demonstrate this, if we override the ‘InputKey’ function inside the ViewportClient class:

bool ULyraGameViewportClient::InputKey(const FInputKeyEventArgs& EventArgs)
{
UE_LOG(LogTemp, Log, TEXT(“[ULyraGameViewportClient] ControllerId: %i, %s”), EventArgs.ControllerId, *EventArgs.Key.ToString());
return Super::InputKey(EventArgs);
}

the game will print ControllerId 0 and 1 depending on what gamepad we use. This is used beautifully in the main menu to add another player for split screen.
I know about the ‘CreatePlayer’ node. Lyra doesn’t use it. So how then do they get input from other gamepads? I am using the exact settings as Lyra… pls help.

Also,
In my experiments I actually managed to break this and now, If I have 2 gamepads connected, the second one is ignored but when I use the first one, it prints 2 times for every button press. I redownloaded the project, checked code and project config, all is identical, the new copy works, the old one does not, no idea how i broke it. :frowning:

EDIT:
With console command ‘showdebug enhancedinput’ i can see that device 0 has a weird name… in the Lyra demo that works they are both (XinputInterface:XInputController)


No idea why or how, but it might be related to the issue. :frowning:

I found it… ?
So Lyra overrides a lot of classes. Sometimes, when replacing one of them (Viewport Client for example), the editor will ask to restart. I don’t think that’s enough in a new project, because I did all this (all the overriding, all the restarting) and input still did not register from the second gamepad.
What fixed it for me was deleting the .vs, backup, binaries, deriveddatacache, intermediate and saved folder, plus the .sln, then right click on .uproject, generate visual studio project, recompile the project and open the editor.
Don’t know what and how, but it works now and I’m happy. Sorry to all the people I spammed with this issue.
:smiley: