RealDocs

AActor::K2_AttachRootComponentTo

function Engine Blueprint Deprecated Since 4.0
Deprecated: Use AttachToComponent() instead.
#include "GameFramework/Actor.h"
Access: public Specifiers: UFUNCTIONBlueprintCallableUE_DEPRECATED

Description

Deprecated Blueprint-facing wrapper that attaches this actor's root component to a given scene component. Replaced by AttachToComponent() with FAttachmentTransformRules since UE 4.17.

Caveats & Gotchas

  • Deprecated since UE 4.17 — calling this in new C++ code will trigger a compile-time deprecation warning. Use AttachToComponent() with explicit FAttachmentTransformRules instead.
  • Uses the legacy EAttachLocation enum which lacks fine-grained scale control. FAttachmentTransformRules lets you independently control Location, Rotation, and Scale rules.

Signature

ENGINE_API void K2_AttachRootComponentTo(USceneComponent* InParent, FName InSocketName = NAME_None, EAttachLocation::Type AttachLocationType = EAttachLocation::KeepRelativeOffset, bool bWeldSimulatedBodies = true);

Parameters

Name Type Description Default
InParent USceneComponent* The scene component to attach this actor's root to.
InSocketName FName Optional socket on InParent to attach to. NAME_None
AttachLocationType EAttachLocation::Type How to handle the actor's existing transform when attaching. EAttachLocation::KeepRelativeOffset
bWeldSimulatedBodies bool Whether to weld simulated physics bodies together. true

Return Type

void

Example

Preferred modern equivalent C++
// Old (deprecated):
// MyActor->K2_AttachRootComponentTo(SocketComponent, NAME_None);

// Use this instead:
MyActor->AttachToComponent(
    SocketComponent,
    FAttachmentTransformRules::SnapToTargetIncludingScale);

Version History

Introduced in: 4.0

Version Status Notes
5.6 deprecated Deprecated since 4.17; retained for Blueprint compatibility only.

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.