UActorComponent::DestroyReplicatedSubObjectOnRemotePeers
#include "Components/ActorComponent.h"
Access: public
Description
Stops replicating a subobject and signals connected actor channels to delete their replica of it on the next replication update. Use when the subobject is being destroyed and you need clients cleaned up immediately.
Caveats & Gotchas
- • This schedules destruction on clients — the actual deletion on each client happens when the actor channel next replicates, not at the instant this call is made on the server.
- • If the subobject has never reached a particular client (e.g. it was added and immediately destroyed before replication occurred), that client simply won't spawn it — no spurious delete is sent.
Signature
ENGINE_API void DestroyReplicatedSubObjectOnRemotePeers(UObject* SubObject) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| SubObject | UObject* | The subobject whose remote replicas should be destroyed. | — |
Return Type
void Example
Immediately remove a subobject from all clients C++
void UMyComponent::KillSubData()
{
if (MySubData)
{
DestroyReplicatedSubObjectOnRemotePeers(MySubData);
MySubData->MarkAsGarbage();
MySubData = nullptr;
}
} See Also
Tags
Version History
Introduced in: 5.1
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?