AActor::IsAttachedTo
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtual
Description
Walks up the component attachment chain to determine whether this actor is attached (directly or transitively) to the given actor.
Caveats & Gotchas
- • This checks component attachment, not movement base (standing-on) relationships. For character movement scenarios where a pawn stands on a non-attached base, use IsBasedOnActor instead.
- • The search traverses the full parent attachment chain upward, so it is O(depth) rather than O(1). Avoid calling it every frame for many actors.
Signature
virtual bool IsAttachedTo( const AActor* Other ) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Other | const AActor* | The actor to test whether this actor is attached to. | — |
Return Type
bool Example
Verify child actor is attached before detaching C++
if (ChildActor->IsAttachedTo(this))
{
ChildActor->DetachFromActor(FDetachmentTransformRules::KeepWorldTransform);
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?