I can’t figure out why my game seems to spawn two copies of a class using one spawn actor line. The on screen debug message I have in the PKillCam runs twice which leads me to believe that it spawns two copies. Here is thecode I currently have:
GetWorld()->LineTraceSingleByChannel(Hit, Start, End, ECC_Pawn, RV_TraceParams);
if (Hit.GetActor() != NULL)
{
APPlayer* Killed = Cast<APPlayer>(Hit.GetActor());
if (Killed)
{
Kill(Killed);
}
}
void APPlayer::Kill(APPlayer* Killed)
{
AActor* Killer = this;
Killed->Die(Killer);
}
void APPlayer::Die(AActor* Killer)
{
Destroy();
GetWorld()->SpawnActor<APKillCam>(GetActorLocation(), GetActorRotation());
}
The line trace is activated in a reliable server function. It also spawns both of them at 0,0,0 instead of the PPlayer actor location. What am I doing wrong?
