Instance Method

clone(recursive:)

Duplicates the anchor entity to create a new entity.

Declaration

func clone(recursive: Bool) -> Self

Parameters

recursive

A Boolean that you set to true to indicate that all descendant entities of the anchor should also be copied. Otherwise, no descendants are copied.

Return Value

A new AnchorEntity instance that is a duplicate of the original.

Discussion

This method clones all component data automatically. When 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 after the clone finishes.

See Also

Creating an Anchor

init()

Creates a new anchor entity.

init(AnchoringComponent.Target)

Creates an anchor entity targeting a particular kind of anchor.

init(anchor: ARAnchor)

Creates an anchor entity that uses an existing AR anchor.

init(raycastResult: ARRaycastResult)

Creates an anchor entity using the information about a real-world surface discovered using a ray-cast query.

init(world: float4x4)

Creates an anchor entity with a target fixed at the given position in the scene.

init(world: SIMD3<Float>)

Creates an anchor entity with a target fixed at the given position in the scene.