AActor::Children
#include "GameFramework/Actor.h"
Access: public
Specifiers: UPROPERTYTransient
Description
Array of all actors whose Owner is this actor. These are not necessarily spawned by a UChildActorComponent — any actor whose Owner is set to this actor will appear here.
Caveats & Gotchas
- • This array is managed by the engine via SetOwner()/GetOwner() — do not add or remove elements directly. Actors are added when their Owner is set to this actor and removed when the owner changes or the child is destroyed.
- • Children is marked Transient, so it is not serialized. After a level load the array is rebuilt at runtime; do not rely on it being populated before BeginPlay.
- • The array does not recursively include grandchildren. An actor owned by a child of this actor will appear in the child's Children array, not here.
Signature
UPROPERTY(Transient)
TArray<TObjectPtr<AActor>> Children; Example
Iterate over owned child actors C++
for (AActor* Child : Children)
{
if (Child && !Child->IsActorBeingDestroyed())
{
Child->SetActorHiddenInGame(true);
}
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?