AActor::GetReplicatedComponents
#include "GameFramework/Actor.h"
Access: public
Specifiers: const
Description
Returns a const reference to the cached array of components that have replication enabled on this actor.
Caveats & Gotchas
- • The returned reference becomes invalid if the array is modified (e.g. by UpdateAllReplicatedComponents). Do not store the reference across frames.
- • The cache may be stale if components have their replication state changed without calling UpdateReplicatedComponent. Verify with component->GetIsReplicated() if precision is critical.
- • Iterating over this array and modifying component replication settings during iteration can cause the underlying array to change — copy the array first if you need to do that.
Signature
const TArray<UActorComponent*>& GetReplicatedComponents() const Return Type
const TArray<UActorComponent*>& Example
Iterate replicated components C++
for (UActorComponent* Comp : GetReplicatedComponents())
{
UE_LOG(LogTemp, Log, TEXT("Replicated component: %s"), *Comp->GetName());
} See Also
Tags
Version History
Introduced in: 4.15
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?