RealDocs

AActor::SetReplicatedComponentNetCondition

function Engine Since 4.27
#include "GameFramework/Actor.h"
Access: public

Description

Changes the network lifetime condition of an already-registered replicated component at runtime, after BeginPlay. Use this to dynamically change which clients receive a component's property updates.

Caveats & Gotchas

  • Only valid after BeginPlay — calling it before the actor has begun play (e.g. in the constructor or PostInitializeComponents) has no effect.
  • The component must already be in the replicated components list. If it is not, the call is silently ignored. Use GetReplicatedComponents to verify.
  • Clients that previously received the component data are not notified of the condition change; they will simply stop receiving future updates if the condition no longer applies to them.

Signature

ENGINE_API void SetReplicatedComponentNetCondition(const UActorComponent* ReplicatedComponent, ELifetimeCondition NetCondition)

Parameters

Name Type Description Default
ReplicatedComponent const UActorComponent* The already-registered replicated component whose condition should change.
NetCondition ELifetimeCondition The new lifetime condition controlling which connections receive this component's replication.

Return Type

void

Example

Restrict a component to the owner after a gameplay event C++
void AMyActor::OnSecretActivated()
{
    // After activation, only the owner should see updates to this component
    SetReplicatedComponentNetCondition(SecretComponent, COND_OwnerOnly);
}

Version History

Introduced in: 4.27

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.