This code (v4.26.0) from actor component always respawn player on it’s death in the current actor location, but not at the player start:
if (Owner)
{
// Find all APlayerStart objects
TArray<AActor*> FoundActors;
UGameplayStatics::GetAllActorsOfClass(GetWorld(), APlayerStart::StaticClass(), FoundActors);
auto PlayerController = Owner->GetController();
auto PlayerStart = Cast<APlayerStart>(FoundActors[0]);
// Shows correct locations for APlayerStart and current actor position
UE_LOG(LogTemp, Warning, TEXT("Player start location %s"), *PlayerStart->GetActorLocation().ToString());
UE_LOG(LogTemp, Warning, TEXT("Player location %s"), *Owner->GetActorLocation().ToString());
GetWorld()->GetAuthGameMode()->RestartPlayerAtPlayerStart(PlayerController, PlayerStart);
}
Why RestartPlayerAtPlayerStart do not respawn player at PlayerStart? Seems that PlayerStart located where it is expected.
Maybe better to use Destroy/Spawn Character and Possess/Unpossess with the current PlayerController?
Any thoughts would be appreciated