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

# clone(recursive:)

Duplicates an entity to create a new entity.

```
@MainActor @preconcurrency func clone(recursive: Bool) -> Self
```

## Parameters

`recursive`

A Boolean that you set to `true` to recursively copy all
the children of the entity. Otherwise, no descendants are copied.

## Return Value

The duplicate.

## Discussion

All component data is cloned automatically. If you clone an entity that
stores custom data that’s not part of a component, override the
[`didClone(from:)`](/documentation/RealityKit/Entity/didClone(from:)) method to copy that data manually.

---

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)