Why is InputComponent/boundkey firing without input?

In my code I’ve bound the letter d to my function MoveRight. I’ve added some AddOnScreenDebugMessages to make sure they binding functions are triggering (and they are).

My issue is that my MoveRight (and MoveLeft) functions are firing at the rate of delta time (this is an assumption, it just appears to fire at this rate) without input from the keyboard.

The function that is being called (with the contents removed except the print):

void APlayerPawn::MoveRight(float Val){
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("RIGHT PRESSED"));
}

The initialization is done this way:

void APlayerPawn::SetupPlayerInputComponent(class UInputComponent* InputComponent){
	check(InputComponent);
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("RIGHTfdsafdsafsafdRESSED"));
	InputComponent->BindAxis("MoveRight", this, &APlayerPawn::MoveRight);	
}

If I put a break point into the MoveRight function and look at the Call Stack I can see what is calling it, but I can’t figure out why.

	UE4Editor-omega_bush_2-1754.dll!APlayerPawn::MoveRight(float Val) Line 61	C++
 	UE4Editor-Engine.dll!UPlayerInput::ProcessInputStack(const TArray<UInputComponent *,FDefaultAllocator> & InputComponentStack, const float DeltaTime, const bool bGamePaused) Line 998	C++
 	UE4Editor-Engine.dll!APlayerController::ProcessPlayerInput(const float DeltaTime, const bool bGamePaused) Line 2147	C++
 	UE4Editor-Engine.dll!APlayerController::PlayerTick(float DeltaTime) Line 1877	C++
 	UE4Editor-Engine.dll!APlayerController::TickActor(float DeltaSeconds, ELevelTick TickType, FActorTickFunction & ThisTickFunction) Line 3385	C++
 	UE4Editor-Engine.dll!FActorTickFunction::ExecuteTick(float DeltaTime, ELevelTick TickType, ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 179	C++
 	UE4Editor-Engine.dll!FTickTaskSequencer::FTickFunctionTask::DoTask(ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 325	C++
 	UE4Editor-Engine.dll!TGraphTask<FTickTaskSequencer::FTickFunctionTask>::ExecuteTask(TArray<FBaseGraphTask *,FDefaultAllocator> & NewTasks, ENamedThreads::Type CurrentThread) Line 661	C++
 	UE4Editor-Core.dll!FTaskThread::ProcessTasks(int QueueIndex, bool bAllowStall) Line 324	C++
 	UE4Editor-Core.dll!FTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 176	C++
 	UE4Editor-Core.dll!FTaskGraphImplementation::WaitUntilTasksComplete(const TArray<TRefCountPtr<FGraphEvent>,TInlineAllocator<4,FDefaultAllocator> > & Tasks, ENamedThreads::Type CurrentThreadIfKnown) Line 856	C++
 	UE4Editor-Engine.dll!FTaskGraphInterface::WaitUntilTaskCompletes(const TRefCountPtr<FGraphEvent> & Task, ENamedThreads::Type CurrentThreadIfKnown) Line 185	C++
 	UE4Editor-Engine.dll!FTickTaskSequencer::ReleaseTickGroup(ETickingGroup WorldTickGroup, bool bBlockTillComplete) Line 185	C++
 	UE4Editor-Engine.dll!FTickTaskManager::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 723	C++
 	UE4Editor-Engine.dll!UWorld::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 695	C++
 	UE4Editor-Engine.dll!UWorld::Tick(ELevelTick TickType, float DeltaSeconds) Line 1127	C++
 	UE4Editor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1184	C++
 	UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 213	C++
 	UE4Editor.exe!FEngineLoop::Tick() Line 1985	C++
 	UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 132	C++
 	UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 196	C++

The file that this code is in is attached to a blueprint PL_Bush (PlayerPawn.h) which is being used as the Default Pawn Class in the GameMode.

If anyone has any information as to why this function is firing I’d greatly appreciate it. I’m afraid to dive into the source of that Call Stack.

Axis are always hit as technically they will be between 0/1 or -1/1, so they always have a value. What you need to check for is if the value you are getting is not 0:

if ((Controller != NULL) && (Value != 0.0f))

This works. Thanks!