Download

How to replicate SetViewTarget after DetachFromControllerPendingDestroy from server

Hi,
I have a probleme for replicate PlayerController->SetViewTarget. My server Handles all the damages. When the character die, I detache the controller on server side and try to set a new view target.
There is no probleme for the server player. But for the client, all methods I tryed to replicate the SetTargetView fail because the controller is imediatly detached and all my client functions are called after the unpossess.
I tried to override UnPossess but it’s not called on client (only on server side).
Where can I intercept the controller detachement / UnPossess on pawn client side with the reference of the old Controller?
Or how can I call a client function from server before DetachFromControllerPendingDestroy to be replicate on client side?

This is my first code I tryed to replicate:


APlayerController* PC = Cast<APlayerController>(GetController());
if (PC)
{
    DetachFromControllerPendingDestroy();
    PC->SetViewTarget(this);
}