Hi all,
I managed to figure this out, I believe I was possessing a null object as when I tried to print this line in the UE_LOG, my editor was crashing:
UE_LOG(LogTemp, Warning, TEXT("%s"), FoundActors[0]->GetWorld()->GetFirstPlayerController()->GetPawn()->GetName())
Instead of GetWorld()->GetFirstPlayerController()->GetPawn() (Which was null), I instead did the following:
TArray<AActor*> FoundActors;
UGameplayStatics::GetAllActorsOfClass(GetWorld(), AGameDefaults::StaticClass(), FoundActors);
if (FoundActors.Num() != 0)
{
AController* SavedController = GetController();
SavedController->UnPossess();
SavedController->Possess(Cast<APawn>(FoundActors[0])); // Here I am accessing the element directly
}
I was simply trying to possess the wrong pawn. Just leaving this here in case anyone else was having a similar issue.