RealDocs

AActor::IsReplicatedActorComponentRegistered

function Engine Since 5.1
#include "GameFramework/Actor.h"
Access: public Specifiers: const

Description

Returns true if the given component is currently registered in the actor's replicated component list and is being replicated.

Caveats & Gotchas

  • This checks the ReplicatedComponentsInfo registry used by the registered sub-object system, not the legacy ReplicatedComponents array. Results may differ depending on which replication system is active.
  • A component can have IsReplicated() == true but not yet be in the registry if UpdateReplicatedComponent hasn't run since it was enabled.
  • Do not use this as a general-purpose 'is this component replicated?' check in gameplay code — use component->GetIsReplicated() for that.

Signature

ENGINE_API bool IsReplicatedActorComponentRegistered(const UActorComponent* ReplicatedComponent) const

Parameters

Name Type Description Default
ReplicatedComponent const UActorComponent* The component to look up in the actor's replicated component registry.

Return Type

bool

Example

Check before adding a component sub-object C++
void AMyActor::AddSubObjectToComponent(UActorComponent* Comp, UObject* SubObj)
{
    if (IsReplicatedActorComponentRegistered(Comp))
    {
        AddActorComponentReplicatedSubObject(Comp, SubObj);
    }
}

Version History

Introduced in: 5.1

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.