Hello,
I’m learning Replication by the Shooter Game sample.
In the class AShooterPlayerController declaration, we have 4 properties marked Replicated as below:
class AShooterPlayerController : public APlayerController
{
…..
/** infinite ammo cheat */
UPROPERTY(Transient, Replicated)
uint8 bInfiniteAmmo : 1;
/** infinite clip cheat */
UPROPERTY(Transient, Replicated)
uint8 bInfiniteClip : 1;
/** health regen cheat */
UPROPERTY(Transient, Replicated)
uint8 bHealthRegen : 1;
/** god mode cheat */
UPROPERTY(Transient, Replicated)
uint8 bGodMode : 1;
…..
}
but in the GetLifetimeReplicatedProps() function only have 2 properties handled. Must all properties for replication handled here? Is this a bug or my misunderstanding?
void AShooterPlayerController::GetLifetimeReplicatedProps( TArray< FLifetimeProperty > & OutLifetimeProps ) const
{
Super::GetLifetimeReplicatedProps( OutLifetimeProps );
DOREPLIFETIME_CONDITION( AShooterPlayerController, bInfiniteAmmo, COND_OwnerOnly );
DOREPLIFETIME_CONDITION( AShooterPlayerController, bInfiniteClip, COND_OwnerOnly );
}