Hey there,
Firstly, the InputComponent I am using is part of a PlayerController custom class called “PlayerControllerC”, this will be used to manipulate the player: “PlayerCharacter”. Right now, my code consists for 3 debugging actions to test, none of which are working; these are listed below:
void APlayerControllerC::SetupInputComponent(/*class UInputComponent * InputComponent*/){
Super::SetupInputComponent();
check(InputComponent);
InputComponent->BindAction("Move", IE_Pressed, this, &APlayerControllerC::MoveTo); // LMB
InputComponent->BindAction("Test", IE_Pressed, this, &APlayerControllerC::Test); // C
InputComponent->BindAxis("MoveX", this, &APlayerControllerC::MoveX); // D
}
-----------------
void APlayerControllerC::MoveTo(){
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::Printf(TEXT("TEST")));
}
void APlayerControllerC::Test(){
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::Printf(TEXT("TEST")));
}
void APlayerControllerC::MoveX(float val){
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::Printf(TEXT("TEST")));
}
When debugging the code, there’s no issue with the InputComponent variable or the creating it, however none of the functions are called on their respective keys. The game is a TopDown(70degree) dungeon crawler, so I followed the TopDown method of constructing an InputComponent.
Can anyone please help and tell me why none of the functions are being called on the keypresses?