RealDocs

UActorComponent::GetReplicationCondition

function Engine Since 5.1
#include "Components/ActorComponent.h"
Access: public Specifiers: virtualconst

Description

Returns the lifetime condition that controls which connections receive this component's replication data. Only consulted when the owning actor uses bReplicateUsingRegisteredSubObjectList.

Caveats & Gotchas

  • The default implementation returns COND_None when the component is replicated and COND_Never when it is not — override to target specific connections (e.g. COND_OwnerOnly for owner-only components).
  • This condition is only evaluated when the actor uses the registered subobject list path; if bReplicateUsingRegisteredSubObjectList is false on the actor this function is never called.

Signature

virtual ELifetimeCondition GetReplicationCondition() const

Return Type

ELifetimeCondition

Example

Restrict component replication to the owning client C++
ELifetimeCondition UMyPrivateComponent::GetReplicationCondition() const
{
	// Only replicate this component to the player who owns the actor
	return GetIsReplicated() ? COND_OwnerOnly : COND_Never;
}

Version History

Introduced in: 5.1

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.