AActor::RemoveActorComponentReplicatedSubObject
#include "GameFramework/Actor.h"
Access: public
Description
Unregisters a UObject that was previously registered as a replicated sub-object of a specific component, stopping its replication. Does not destroy remote replicas.
Caveats & Gotchas
- • Like RemoveReplicatedSubObject, this does not destroy the client's replica — it only stops future replication. Call DestroyReplicatedSubObjectOnRemotePeers if the client copy should also be cleaned up.
- • Both the OwnerComponent and SubObject pointers must match exactly what was passed to AddActorComponentReplicatedSubObject. Passing a different component pointer for the same sub-object will silently fail.
- • Must be called before the sub-object or its owner component is destroyed to prevent stale registry entries.
Signature
ENGINE_API void RemoveActorComponentReplicatedSubObject(UActorComponent* OwnerComponent, UObject* SubObject) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| OwnerComponent | UActorComponent* | The component that owns the sub-object to unregister. | — |
| SubObject | UObject* | The sub-object to remove from the component's replication list. | — |
Return Type
void Example
Clean up before component destruction C++
void AMyActor::ClearStatusEffect()
{
if (IsActorComponentReplicatedSubObjectRegistered(StatusComponent, StatusEffect))
{
RemoveActorComponentReplicatedSubObject(StatusComponent, StatusEffect);
}
StatusEffect = nullptr;
} See Also
Tags
Version History
Introduced in: 5.1
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?