<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/Entity/attach(_:to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation6EntityC6attach_2toyAA12GeometricPinVSg_AGtF"
  },
  "title" : "attach(_:to:)"
}
-->

# attach(_:to:)

Attach an entity to a target pin owned by another entity with an optional specified source pin
This utility function has the same effect of adding an AttachedTransformComponent
created with the same parameter to the entity you are calling upon

```
@MainActor func attach(_ source: GeometricPin? = nil, to target: GeometricPin)
```

## Parameters

`source`

The optional source pin existed on the current entity

`target`

The target pin existed on the target entity

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)