So I am pretty well informed on how UE4’s networking works (I’ve read all documentation before) so I have a pretty good understanding. But I really am confused on this problem. So I have an empty client RPC on my character
UFUNCTION(Client, Reliable)
void ClientEmptyRPC();
and I want to call it in the character’s AShooterCharacter::PossessedBy and this is what I have.
void AShooterCharacter::PossessedBy(AController* NewController)
{
Super::PossessedBy(NewController);
ClientEmptyRPC();
}
void AShooterCharacter::ClientEmptyRPC_Implementation()
{
}
Now. Can someone please explain why this screws up my gameplay code? I may just not understand client RPCs well enough but this seems really strange to me especially since it’s an empty implementation. I figured I would be safe to do RPCs after PossessedBy since the ownership of the character is established (I think).
I should mention I found that if I put the ClientEmptyRPC on the controller my gameplay code doesn’t break.
void AShooterCharacter::PossessedBy(AController* NewController)
{
Super::PossessedBy(NewController);
ASSPlayerController* MyPlayerController = Cast<ASSPlayerController>(NewController);
MyPlayerController->ClientEmptyRPC();
}
I need this RPC on the character class though so this isn’t a solution for me (also I really want to know whats wrong).
I have also found that using a delay before the RPC fixes the problem (but that’s not a solution either).