Hi,
I need to return a boolean from a Keypress in Unreal.
When I call this in AMyPawn::BeginPlay() it works just fine but I can just call a void function from it.
void AMyPawn::BeginPlay()
{
Super::BeginPlay();
APlayerController* PC = GetWorld()->GetFirstPlayerController();
PupilUser->InputComponent->BindKey(EKeys::Enter, IE_Pressed, this, &AMyPawn::PrintTestStringToScreen);
}
//Prints me a beautiful string on my Screen
So I tried different options like
void AMyPawn::BeginPlay()
{
Super::BeginPlay();
if(PC->WasInputKeyJustPressed(EKeys::AnyKey);
GEngine->AddOnScreenDebugMessage(-1, 50.f, FColor::Red, TEXT("Key pressed"));
if(PC->IsInputKeyDown(EKeys::AnyKey);
GEngine->AddOnScreenDebugMessage(-1, 50.f, FColor::Red, TEXT("Key pressed"));
}
Compiling ist just fine of them but if I press a key nothing happens. Can You please help me and tell me what I am missing or doing wrong?
Thank You!