Hey, I’m just adding the actors from a sphere trace to an array and then attempting to sort them by distance to the AI. This is my first time using the Sort() function and i swear this compiled previously.
TArray<AActor*> TargetActors;
FVector Location = TreeComp.GetAIOwner()->GetPawn()->GetActorLocation();
TargetActors.Sort([Location](const AActor* A, const AActor* B)
{
return FVector::DistSquared(Location, A->GetActorLocation()) < FVector::DistSquared(Location, B->GetActorLocation());
});
Visual Studios says No Issues Found but there’s a bunch of errors when compiling.
Any help is appreciated thanks