float result = InputComponent->GetAxisKeyValue(EKeys::A);
if ( result){
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("This is an on screen message!"));
}
I have that in my Tick function. The tick function actually gets called, but apparently there is something wrong with the above code. I tried other keys, but still nothing.
An input component itself does nothing unless it is enabled and added to the player input ‘stack’.
This gets processed by the player input class, which itself is called from the player controller.
So the question is, which tick function?
Actor? Pawn? PlayerController? Other?
For example, detecting the key input from a Pawn, you could do:
if (APlayerController* PC = Cast<APlayerController>(Controller))
{
if (PC->InputKeyDown(EKeys::A))
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("This is an on screen message!"));
}
}
I have the UInputComponent I receive at the SetupPlayerInputComponent override for my class which inherits from ACharacter.
That being so, the Tick function is from an Actor, since Character inherits from it.