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?