I used my code in my Player Controller like this:
InputComponent->BindKey(EKeys::Left, IE_Pressed,this,&AMyPlayerController_CPP::setLEFTOn).bExecuteWhenPaused=true;
InputComponent->BindKey(EKeys::Left, IE_Released,this,&AMyPlayerController_CPP::setLEFTOff).bExecuteWhenPaused=true;
InputComponent->BindKey(EKeys::Right, IE_Pressed,this,&AMyPlayerController_CPP::setRIGHTOn).bExecuteWhenPaused=true;
InputComponent->BindKey(EKeys::Right, IE_Released,this,&AMyPlayerController_CPP::setRightOff).bExecuteWhenPaused=true;
InputComponent->BindKey(EKeys::Up, IE_Pressed,this,&AMyPlayerController_CPP::setUPOn).bExecuteWhenPaused=true;
InputComponent->BindKey(EKeys::Gamepad_DPad_Up, IE_Pressed,this,&AMyPlayerController_CPP::setUPOn).bExecuteWhenPaused=true;
InputComponent->BindKey(EKeys::Up, IE_Released,this,&AMyPlayerController_CPP::setUPOff).bExecuteWhenPaused=true;
InputComponent->BindKey(EKeys::Down, IE_Pressed,this,&AMyPlayerController_CPP::setDOWNOn).bExecuteWhenPaused=true;
InputComponent->BindKey(EKeys::Gamepad_DPad_Down, IE_Pressed,this,&AMyPlayerController_CPP::setDOWNOn).bExecuteWhenPaused=true;
InputComponent->BindKey(EKeys::Down, IE_Released,this,&AMyPlayerController_CPP::setDOWNOff).bExecuteWhenPaused=true;
InputComponent->BindKey(EKeys::Android_Back, IE_Pressed,this,&AMyPlayerController_CPP::quitGame).bExecuteWhenPaused=true;
InputComponent->BindKey(EKeys::K, IE_Pressed,this,&AMyPlayerController_CPP::quitGame).bExecuteWhenPaused=true;
InputComponent->BindKey(EKeys::Q, IE_Pressed,this,&AMyPlayerController_CPP::quitGame);
InputComponent->BindKey(EKeys::LeftMouseButton,IE_Released,this,&AMyPlayerController_CPP::releaseMouseButton).bExecuteWhenPaused=true;
InputComponent->BindKey(EKeys::P, IE_Pressed,this,&AMyPlayerController_CPP::SetPauseBP).bExecuteWhenPaused = true;
InputComponent->BindKey(EKeys::Gamepad_FaceButton_Bottom,IE_Pressed,this,&AMyPlayerController_CPP::SetPauseBP).bExecuteWhenPaused=true;
and worked flawless maybe is because of the UE version? I use 4.27