Download

help me! Custom input device error

hi

i need create a user input device

I made two links.

but

When you map a key, no value is entered.

GenericInputDevicePlugin.cpp
void FGenericInputDevice::SendControllerEvents()
{
const double CurrentTime = FPlatformTime::Seconds();
const float CurrentTimeFloat = FPlatformTime::ToSeconds(FPlatformTime::Cycles());

ControllerState.State = FMath::Sin(CurrentTimeFloat * .223f * 2 * PI);
MessageHandler->OnControllerAnalog(ControllerState.Axis, ControllerState.ControllerIndex, ControllerState.GetValue());
FSlateApplication::Get().OnControllerAnalog(ControllerState.Axis, ControllerState.ControllerIndex, ControllerState.GetValue());

UE_LOG(LogTemp, Warning, TEXT("Sending dummy analog controller event! x:%f , id:%d"), ControllerState.State, ControllerState.ControllerIndex);

}

The log message is displayed in the editor log window
If you create and execute a keystroke in blueprints, the input will not work.

d5b2e4712b41d28684d94231acdacd83051cd46e.png
5ddacb1c043cb99afecf8edc0d05a131d8ff37b9.png

Hi Sir, (can’t read that name :p)

I had the same problem before, for some reason the player index 0 is always constrained to the keyboard, even if your log displays is OK, the event never call from your custom input inside your blueprint right?, FSlateApplication::Get().OnControllerAnalog is working well at this stage. (if you want check that, add a second player in split screen, your input will reach the second player only)

In order to fix this I modified a setting inside the project settings, go to Maps & Modes -> Local Multiplayer -> Skip Assigning Gamepad to Player 1, and another super important thing, after modify this setting restart the editor please,
it was one of the must annoying problem ever!, for me is bad coding practice from epic, (locking functions from no where in another portion of code from no where? OMG!!! ))))