When I put a replicated variable in a custom C++ AGameState and connect through a session ,the server PlayerController spawns normally but the game breaks on the clients, I’m sure that the BeginPlay() event is not called on all of them no matter what I try.
I’m sure there’s a different reason for such behavior. Need more detail. What variable , what it does, are there any methods like OnRep stuff, that may do something funny.
Are you calling the Super for GetLifetimeReplicatedProps?
Such as:
void AActor::GetLifetimeReplicatedProps( TArray< FLifetimeProperty > & OutLifetimeProps ) const
{
Super::GetLifetimeReplicatedProps( OutLifetimeProps );
DOREPLIFETIME( AActor, Owner );
}
Pretty much any replicated variable with GetLifetimrReplicated breaks the clients, even standard types like float or int32. I don’t get any compiling errors.
I think i forgot that, I can’t replicate the problem because i changed my code around using the game state, but that might have been it.
I had the same issue, and I had indeed forgot to call Super in GetLifetimeReplicatedProps. Good call.