---
title: "clone(recursive:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/entity/clone(recursive:)"
---

# clone(recursive:)

Duplicates an entity to create a new entity.

## Declaration

```swift
@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

Return Value The duplicate.

## Discussion

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:) method to copy that data manually.

## See Also

### Creating an entity

- [init()](realitykit/entity/init().md)
- [init(components:)](realitykit/entity/init(components:)-1lmhe.md)
- [init(components:)](realitykit/entity/init(components:)-1lmhe.md)
- [didClone(from:)](realitykit/entity/didclone(from:).md)
