Thank you SO much! I’m really stuck here, derailed my progress (and motivation) by months.
void AShooterAIController::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
APawn* PlayerPawn = UGameplayStatics::GetPlayerPawn(GetWorld(), 0);
if(LineOfSightTo(PlayerPawn))
{
GetBlackboardComponent()->SetValueAsVector(TEXT("PlayerLocation"), PlayerPawn->GetActorLocation());
GetBlackboardComponent()->SetValueAsVector(TEXT("LastKnownPlayerLocation"), PlayerPawn->GetActorLocation()); // Setting LastKnownLocation
}
else
{
//ClearFocus(EAIFocusPriority::Gameplay);
//StopMovement();
GetBlackboardComponent()->ClearValue(TEXT("PlayerLocation"));
}
}