when i try to possess a pawn that i spawned in my custom game mode, it only works on the listen server and on none of the clients
the clients cameras move over to the spawn but i cant move the camera or the pawn. on the listen server it replicates correctly to the other clients and the pawn is movable
heres the function that’s called that spawns the pawns and possess them
void ACustomGameMode::StartRound()
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("ROUND STARTING"));
TObjectIterator<ACustomPlayerController> Itr;
for (Itr; Itr; ++Itr)
{
ACustomPlayerState* PlayerState = Cast<ACustomPlayerState>(Itr->PlayerState);
APawn* OldPawn = Itr->GetPawn();
switch (PlayerState->GetJobChoice())
{
default:
{
PlayerState->SetIsPlaying(true);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("CASE DEFAULT"));
if (OldPawn) { OldPawn->Destroy(); }
FActorSpawnParameters SpawnParams;
SpawnParams.Owner = *Itr;
SpawnParams.bNoCollisionFail = true;
SpawnParams.bNoFail = true;
FVector const SpawnLocation = FVector(0, 0, 512);
FRotator const SpawnRotation = FRotator(0, 0, 0);
UWorld* const World = GetWorld();
AActor* const NewHumanPawn = World->SpawnActor(DefaultHumanClass, &SpawnLocation, &SpawnRotation, SpawnParams);
Itr->Possess(Cast<APawn>(NewHumanPawn));
break;
}
case 2:
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("CASE 2"));
break;
}
}
}