RealDocs

UActorComponent::PreReplication

function Engine Since 4.0
#include "Components/ActorComponent.h"
Access: public Specifiers: virtual

Description

Called by the replication system immediately before this component's properties are replicated. Override to conditionally disable replication of specific properties using DOREPLIFETIME_ACTIVE_OVERRIDE.

Caveats & Gotchas

  • The base implementation is an empty inline — no Super call is needed, but calling it is harmless.
  • Changes made to the component's state inside PreReplication are serialised in the same replication update, so avoid triggering additional state changes here that would cause property drift on clients.

Signature

virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker)

Parameters

Name Type Description Default
ChangedPropertyTracker IRepChangedPropertyTracker& Tracker used to conditionally disable replication of specific properties for this component.

Return Type

void

Example

Conditionally suppress property replication C++
void UMyComponent::PreReplication(IRepChangedPropertyTracker& ChangedPropertyTracker)
{
	// Only replicate Health when the actor is alive
	DOREPLIFETIME_ACTIVE_OVERRIDE(UMyComponent, Health, bIsAlive);
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.