This works for me no with problems.
TArray<FVector> ANavTester::GetPathPoints() {
TArray<FVector> points;
// where target is of type pointer to AActor;
if (Target) {
FVector targetLoc = Target->GetActorLocation();
UNavigationSystemV1* NavManager = UNavigationSystemV1::GetCurrent(GetWorld());
check(NavManager);
UNavigationPath* Path = NavManager->FindPathToLocationSynchronously(GetWorld(), GetActorLocation(), targetLoc, this);
check(Path);
FNavPathSharedPtr p = Path->GetPath();
if (p.IsValid()) {
const TArray<FNavPathPoint> npoints = p.Get()->GetPathPoints();
for (FNavPathPoint point : npoints) {
points.Add(point.Location);
}
}
}
return points;
}
Perhaps you left out checks for elements?