Download

BindAction works but BindAxis crashes project

Inside player controller


void AChessDemoPlayerController::PostInitializeComponents() {
	Super::PostInitializeComponents();
	SetupInputComponent();
}

And inside SetupInputComponent


void AChessDemoPlayerController::SetupInputComponent() {
	Super::SetupInputComponent();
	check( InputComponent );
	if (!HasAuthority()) {
		UE_LOG(LogTemp, Warning, TEXT("Binding actions"));
		InputComponent->BindAction("MouseLeftButton", IE_Released, this, &AChessDemoPlayerController::OnMouseLeftButtonReleased);
		InputComponent->BindAction("MouseRightButton", IE_Pressed, this, &AChessDemoPlayerController::OnMouseRightButtonPressed);
		InputComponent->BindAction("MouseRightButton", IE_Released, this, &AChessDemoPlayerController::OnMouseRightButtonReleased);

		UE_LOG(LogTemp, Warning, TEXT("Binding axis"));
		InputComponent->BindAxis("MouseWheel", this, &AChessDemoPlayerController::OnMouseWheelTurned);

		UE_LOG(LogTemp, Warning, TEXT("Finished binding"));
	}
}

And the definition of the call back functions


void OnMouseLeftButtonReleased();
void OnMouseRightButtonPressed();
void OnMouseRightButtonReleased();

void OnMouseWheelTurned(float pTurnRate);

This compiles ok. But editor crashes when I run the game. I saw the crash report and this is there.

But when I comment the BindAxis line, compile and run it runs without crashing.

I setup the binding in project settings also.

Why is it crashing when i bind axis? How can I fix this?

Maybe similar names gave it hiccups?


InputComponent->BindAction("MouseRightButton", IE_Pressed, this, &AChessDemoPlayerController::OnMouseRightButtonPressed);
InputComponent->BindAction("MouseRightButton", IE_Released, this, &AChessDemoPlayerController::OnMouseRightButtonReleased); 

This works perfectly. Its not similar name its binding two events for same button. Pressed and releases. Even if I comment all BindActions and just keep only BindAxis inside SetupInputComponent() it still crashes.

What does the Stack say when the Editor Crashs? (The window that opens up after the crash)