AActor::DestroyReplicatedSubObjectOnRemotePeers
#include "GameFramework/Actor.h"
Access: public
Description
Stops replicating a sub-object and instructs actor channels to delete its replica on all connected clients the next time the actor replicates. The local authority-side object is not destroyed automatically.
Caveats & Gotchas
- • The client replica is not destroyed immediately — it is marked for deletion and cleaned up the next time the owning actor is replicated to each connection.
- • The caller is responsible for destroying the server-side object after this call. This function only manages the remote replicas.
- • An overload exists that accepts a UActorComponent* owner alongside the SubObject pointer for sub-objects owned by a component — do not confuse the two signatures.
Signature
ENGINE_API void DestroyReplicatedSubObjectOnRemotePeers(UObject* SubObject) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| SubObject | UObject* | The sub-object whose client replicas should be destroyed. | — |
Return Type
void Example
Remove sub-object and clean up client replicas C++
void AMyActor::RemoveQuestData(UQuestData* Quest)
{
// Tell clients to destroy their replica, then clean up the server object
DestroyReplicatedSubObjectOnRemotePeers(Quest);
Quest->MarkAsGarbage();
ActiveQuests.Remove(Quest);
} See Also
Tags
Version History
Introduced in: 5.1
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?