RealDocs

AActor::SetReplicates

function Engine Blueprint Since 4.0
#include "GameFramework/Actor.h"
Access: public Specifiers: UFUNCTIONBlueprintCallableBlueprintAuthorityOnly

Description

Enables or disables replication for this actor at runtime. When enabled, the actor is added to the network actor list and its UPROPERTY(Replicated) members will sync to clients.

Caveats & Gotchas

  • This is a `BlueprintAuthorityOnly` function — calling it from a client has no effect. All replication decisions must go through the server.
  • Enabling replication after BeginPlay is valid but expensive: the actor must be sent in full to all connected clients the next time it becomes relevant, which can spike bandwidth.
  • Prefer setting `bReplicates = true` in the constructor (or checking 'Replicates' in the class defaults) rather than calling SetReplicates at runtime unless you truly need dynamic toggling. Constructor-set replication avoids mid-game full-state sends.

Signature

UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category=Networking)
ENGINE_API void SetReplicates(bool bInReplicates);

Parameters

Name Type Description Default
bInReplicates bool Whether this actor should replicate to connected clients.

Return Type

void

Example

Enable replication dynamically when a pickup is activated C++
void APickupActor::Activate()
{
	if (HasAuthority())
	{
		SetReplicates(true);
		SetReplicateMovement(true);
	}
}

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.