Attach Actor To Component¶
At a glance
Lives in: Blueprint API / Transformation -
Target: the actor you are attaching; Unreal attaches that actor's
RootComponent -
Parent: the scene component to attach to, often a character mesh socket -
Returns: Boolean; true means the attachment request succeeded -
Fails by: returning false, usually without a special failure branch -
Official docs: Attach Actor To Component
The one-minute version¶
Attach Actor To Componentmakes one actor follow a component on another actor by attaching the first actor's root component to the parent component.- It is a transform relationship, not ownership, possession, inventory, or damage attribution.
- The three transform rules answer one question: what should happen to the child's location, rotation, and scale at the instant it becomes attached?
- For equipping a weapon to a hand socket, the usual rule is Snap to Target for location and rotation, and usually Keep World or Snap to Target for scale depending on the asset.
- The parent component must be a registered scene component. A common parent is
a
SkeletalMeshComponent; a socket name picks a named attach point on that mesh. - Physics can fight attachment. For held items, turn off Simulate Physics before attaching unless you deliberately want welded simulated bodies.
What it actually does¶
Actors do not attach directly to other actors. Scene components attach to scene components. The actor-level Blueprint node is a convenience wrapper around that component system:
pseudocode of the engine behavior - not engine source
function AttachActorToComponent(TargetActor, ParentComponent, Rules, SocketName):
ChildRoot = TargetActor.RootComponent
if ChildRoot is missing or ParentComponent is missing:
return false
if ParentComponent is not registered:
return false
attach ChildRoot to ParentComponent at SocketName using Rules
return whether the component attachment succeeded
After the attach succeeds, the child actor's root component has an attach parent. When the parent component moves, rotates, or scales, the child moves with it. That is why a sword attached to a character mesh socket follows the hand animation, and a pickup attached to a moving platform rides along with the platform.
The relationship is visible in the component tree:
flowchart LR
Character[BP_PlayerCharacter] --> Mesh[SkeletalMeshComponent]
Mesh -- socket: hand_r_socket --> SwordRoot[BP_Sword RootComponent]
SwordRoot --> Sword[BP_Sword actor]
This is different from actor Owner. Owner is mostly about networking,
visibility flags, and permission to call server events through an owning player
chain. Attachment is about transforms. A weapon can be attached to a character
without having its actor Owner set, and an actor can have an Owner without being
attached to anything.
The transform rules in plain English¶
The node has separate rules for location, rotation, and scale. Each rule is applied once at the moment of attachment to calculate the child's new relative transform under the parent.
| Rule | Beginner translation | Common use |
|---|---|---|
| Keep Relative | Keep the child's current relative numbers. Under a new parent, that can make the actor jump in world space. | You already set the child up as an offset from this exact parent. |
| Keep World | Keep the child where it is in the world right now, then start following the parent from there. | You want to parent an actor without visible popping. |
| Snap to Target | Move that transform channel to the parent/socket. | Equipping weapons, attaching effects to sockets, snapping pickups into a holder. |
Because the rules are separate, a common weapon setup is:
Location Rule = Snap to Target
Rotation Rule = Snap to Target
Scale Rule = Keep World
Socket Name = hand_r_socket
That says: put the weapon at the hand socket and match the socket's rotation, but do not accidentally stretch the weapon if the character mesh has unusual scale. If your socket or asset is authored so scale should come from the parent, use Snap to Target for scale too.
The socket name is just a name. If it is wrong, the result is not the socket you meant. Use the socket picker when possible, print the name while debugging, and check the Skeletal Mesh asset's Skeleton or Socket Manager instead of guessing the spelling.
When it fails (and what failure does)¶
The node returns false when Unreal rejects the attachment request. It does not
run a Failed execution pin, spawn a replacement parent, or wait until the parent
is ready.
Common causes:
- The Target actor is missing a root component. The actor-level node
attaches the target's
RootComponent; without one, there is nothing to attach. - The Parent pin is
None. You must pass a scene component, not just the other actor. - The parent component is not registered. The official page calls this out because runtime attachment expects a live component in the world.
- The attachment would create an invalid hierarchy. A component cannot attach to itself or create a cycle through one of its children.
- Mobility or physics setup fights the request. Static/movable mismatches, active simulation, collision, or welding can make the result look wrong even when the node returns true.
Failure has no hidden side effect beyond the failed request. The child is not destroyed, the parent is not changed, and actor Owner is not set for you.
Sockets, physics, and the held-item trap¶
Sockets are named attach points on a component, most often a skeletal mesh. They are how "put this sword in the right hand" becomes data instead of a pile of offsets in Blueprint.
The usual equip flow is:
Spawn Actor from Class (BP_Sword)
-> Attach Actor To Component
Target = spawned sword
Parent = character mesh
Socket Name = hand_r_socket
Location/Rotation = Snap to Target
Scale = Keep World
Weld Simulated Bodies = false
Before attaching a pickup that was simulating physics in the world, do the cleanup explicitly:
Pickup mesh
-> Set Simulate Physics false
-> Set Collision Enabled No Collision or Query Only
-> Attach Actor To Component
If physics stays enabled, the physics simulation and the attachment hierarchy both want to own the transform. That is the classic "the item snaps to my hand, then falls off or jitters" bug.
Weld Simulated Bodies is advanced. When both sides are simulated primitive
components, welding can merge the attached body's shapes into the parent body.
That can be useful for building one simulated object out of parts, but it is
not the normal first-project equip setting. Epic's docs warn that welded body
changes can persist after later detach operations, so use it deliberately.
The pattern everyone actually uses¶
For equipping a weapon:
Character picks up BP_Sword
-> Set sword mesh Simulate Physics false
-> Set sword collision to ignore pawn or query only
-> Attach Actor To Component
Target = BP_Sword
Parent = Character Mesh
Socket Name = hand_r_socket
-> Set Owner if multiplayer RPC/owner visibility needs it
-> Store EquippedWeapon variable
Notice the last two steps are separate. Attachment makes the sword follow the hand. Setting Owner and storing a variable are gameplay relationships your Blueprint owns.
For an object that should detach and drop later:
Detach From Actor (Keep World)
-> Set collision back to block/world pickup settings
-> Set Simulate Physics true
-> Clear EquippedWeapon variable
That order avoids re-enabling physics while the object is still parented to the character's hand.
The C++ twin, for the curious (our own example code):
void AHeroCharacter::EquipWeapon(AActor* Weapon)
{
if (!IsValid(Weapon) || !GetMesh())
{
return;
}
const FAttachmentTransformRules Rules(
EAttachmentRule::SnapToTarget,
EAttachmentRule::SnapToTarget,
EAttachmentRule::KeepWorld,
false);
const bool bAttached =
Weapon->AttachToComponent(GetMesh(), Rules, TEXT("hand_r_socket"));
if (bAttached)
{
EquippedWeapon = Weapon;
Weapon->SetOwner(this);
}
}
Lookalikes - which one do I want?¶
| Node or tool | Use when | Watch out |
|---|---|---|
| Attach Actor To Component | You have an actor and want its root component to follow a specific component/socket. | It only attaches the root component. |
| Attach Component To Component | You are attaching one component directly to another component. | Better when the thing is a component, not a separate actor. |
| Attach Actor To Actor | You want to attach to another actor's root component. | Less precise than choosing the parent component/socket yourself. |
| Detach From Actor | The attached actor should stop following its parent. | Pick Keep World if you do not want visible popping at detach time. |
| Set Owner | You need actor ownership for networking/visibility. | It does not move or parent the actor. |
| Child Actor Component | A designed child actor is part of another actor's component setup. | Good for authored composition, not for arbitrary runtime pickups. |
| Spawn Actor from Class | The actor does not exist yet. | Spawning does not attach unless you attach after spawn. |
Rule of thumb: spawn creates the actor, attach gives it a transform parent, Owner controls a networking relationship, and your own variables define inventory or equipment state.
Going deeper¶
- Spawn Actor from Class - create the actor before you attach it, and understand why Owner is not attachment.
- Ownership and lifetime - actor Owner, component owner, and attachment are separate relationships.
- Construction Script vs BeginPlay - when setup belongs in authored components versus runtime attachment.
- Is Valid - guard the target actor and parent component before attaching when either can be missing.
- Official docs: Attach Actor To Component, AActor::AttachToComponent, USceneComponent::AttachToComponent, EAttachmentRule, and FAttachmentTransformRules.
- Engine source (requires engine access - we do not reproduce it here):
AActor::AttachToComponentinEngine/Source/Runtime/Engine/Private/Actor.cpp;USceneComponent::AttachToComponentand the Blueprint wrapperUSceneComponent::K2_AttachToComponentinEngine/Source/Runtime/Engine/Private/Components/SceneComponent.cpp; transform-rule declarations inEngine/Source/Runtime/Engine/Classes/Engine/EngineTypes.h.