AActor::TearOffReplicatedSubObjectOnRemotePeers
#include "GameFramework/Actor.h"
Access: public
Description
Stops replicating a sub-object and releases the network engine's reference to the client replica, leaving the client-side object alive but no longer updated. Use this when you want the client to keep its local copy after deregistration.
Caveats & Gotchas
- • Unlike DestroyReplicatedSubObjectOnRemotePeers, this does NOT destroy the client replica — the engine simply stops holding a reference to it. It is then the responsibility of other client-side systems to clean it up.
- • After tearing off, the client's copy retains the last replicated state and will not receive further updates. If the client has logic that depends on the sub-object being up to date, that logic will break.
- • An overload exists accepting a UActorComponent* owner for sub-objects belonging to a component.
Signature
ENGINE_API void TearOffReplicatedSubObjectOnRemotePeers(UObject* SubObject) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| SubObject | UObject* | The sub-object whose replication should be torn off on remote connections. | — |
Return Type
void Example
Tear off a projectile's replication data on impact C++
void AMyProjectile::OnImpact()
{
// Keep the client's instance alive for VFX but stop receiving updates
TearOffReplicatedSubObjectOnRemotePeers(ImpactData);
// Server-side cleanup:
ImpactData = nullptr;
} Tags
Version History
Introduced in: 5.1
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?