<!--
{
  "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",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation6EntityC"
  },
  "title" : "Entity"
}
-->

# Entity

An element of a RealityKit scene to which you attach components that provide
appearance and behavior characteristics for the entity.

```
@MainActor @preconcurrency class Entity
```

## Overview

You create and configure entities to embody objects that you want to place
in the real world in an AR app. You do this by adding [`Entity`](/documentation/RealityKit/Entity) instances
to the [`Scene`](/documentation/RealityKit/Scene) instance associated with an [`ARView`](/documentation/RealityKit/ARView).

RealityKit defines a few concrete subclasses of [`Entity`](/documentation/RealityKit/Entity) that provide
commonly used functionality. For example, you typically start by creating an
instance of [`AnchorEntity`](/documentation/RealityKit/AnchorEntity) to anchor your content, and add the anchor to a
scene’s [`anchors`](/documentation/RealityKit/Scene/anchors) collection. You might then instantiate a
[`ModelEntity`](/documentation/RealityKit/ModelEntity) to represent a physical object in the scene, and add that as
a child entity to the anchor. You can also create custom entities, and add
them either to an anchor, or as children of another entity.

![Block diagram showing how entity hierarchies, composed of different kinds](images/com.apple.RealityKit/Entity-1@2x.png)

You can load predefined entities or a hierarchy of entities from your app’s
bundle, or from a file on disk, using the methods in [Stored entities](/documentation/RealityKit/stored-entities).
Alternatively, you can create entities programmatically.

Entities contain components (instances conforming to the [`Component`](/documentation/RealityKit/Component)
protocol) that provide appearance and behaviors for the entity. For example,
the [`Transform`](/documentation/RealityKit/Transform) component contains the scale, rotation, and translation
information needed to position an entity in space. You store components in
the entity’s [`components`](/documentation/RealityKit/Entity/components) collection, which can hold exactly one of
any component type. It makes sense to have only a single [`Transform`](/documentation/RealityKit/Transform)
component, one [`ModelComponent`](/documentation/RealityKit/ModelComponent) (specifying the visual appearance of the
entity), and so on.

![Diagram showing the components present in the base entity class, as well](images/com.apple.RealityKit/Entity-2@2x.png)

All entities inherit a few common components from the [`Entity`](/documentation/RealityKit/Entity) base class:
the [`Transform`](/documentation/RealityKit/Transform) component for spatial positioning, and
[`SynchronizationComponent`](/documentation/RealityKit/SynchronizationComponent), which enables synchronization of the entity
among networked peers. Specific types of entities define additional
behaviors. For example, the model entity has components for visual
appearance ([`ModelComponent`](/documentation/RealityKit/ModelComponent)), collision detection
([`CollisionComponent`](/documentation/RealityKit/CollisionComponent)), and physics simulations ([`PhysicsBodyComponent`](/documentation/RealityKit/PhysicsBodyComponent)
and [`PhysicsMotionComponent`](/documentation/RealityKit/PhysicsMotionComponent)).

## Topics

### Creating an entity

[`init()`](/documentation/RealityKit/Entity/init())

Creates a new entity.

[`convenience init(components: [any Component])`](/documentation/RealityKit/Entity/init(components:)-1lmhe)

Creates an entity with multiple components.

[`convenience init(components: [any Component])`](/documentation/RealityKit/Entity/init(components:)-1lmhe)

Creates an entity with multiple components.

[`func clone(recursive: Bool) -> Self`](/documentation/RealityKit/Entity/clone(recursive:))

Duplicates an entity to create a new entity.

[`func didClone(from: Entity)`](/documentation/RealityKit/Entity/didClone(from:))

Tells a newly cloned entity that cloning is complete.

### Loading an entity from a file

  <doc://com.apple.documentation/documentation/visionOS/generating-procedural-textures-in-visionos>

[`protocol Resource`](/documentation/RealityKit/Resource)

A shared resource you use to configure a component, like a material, mesh,
or texture.

[Loading entities from a file](/documentation/RealityKit/loading-entities-from-a-file)

Retrieve an entity from storage on disk using a synchronous or an asynchronous load
operation.

[Stored entities](/documentation/RealityKit/stored-entities)

Manage entities that you store as assets on disk.

  <doc://com.apple.documentation/documentation/USD/creating-usd-files-for-apple-devices>

[`convenience init(contentsOf: URL, withName: String?) async throws`](/documentation/RealityKit/Entity/init(contentsOf:withName:))

Creates an entity by asynchronously loading it from a file URL.

[`convenience init(named: String, in: Bundle?) async throws`](/documentation/RealityKit/Entity/init(named:in:))

Creates an entity by asynchronously loading it from a bundle.

[`struct ReferenceComponent`](/documentation/RealityKit/ReferenceComponent)

A component that can load another entity from a file.

### Loading an entity from a configuration catalog

[`convenience init(from: Entity.ConfigurationCatalog, configurations: [String : String]?) async throws`](/documentation/RealityKit/Entity/init(from:configurations:))

Loads an entity from a configuration catalog and a dictionary of configuration choices.

[`struct ConfigurationCatalog`](/documentation/RealityKit/Entity/ConfigurationCatalog)

A collection of alternative representations of an entity you can choose from.

### Positioning entities in space

[`protocol HasTransform`](/documentation/RealityKit/HasTransform)

An interface that enables manipulating the scale, rotation, and translation
of an entity.

[`struct Transform`](/documentation/RealityKit/Transform)

A component that defines the scale, rotation, and translation of an entity.

[`func transformMatrix(relativeTo: Entity.CoordinateSpaceReference) -> float4x4?`](/documentation/RealityKit/Entity/transformMatrix(relativeTo:))

Returns the 4 x 4 transform matrix of an entity relative to the given
coordinate space.

[`enum CoordinateSpaceReference`](/documentation/RealityKit/Entity/CoordinateSpaceReference)

Defines the coordinate space reference for transform conversion.

[`enum ForwardDirection`](/documentation/RealityKit/Entity/ForwardDirection)

Defines the forward direction for an entity.

### Relating entities

[`var parameters: Entity.ParameterSet`](/documentation/RealityKit/Entity/parameters)

Represents a reference to the parameters for a particular entity.

[`struct ChildCollection`](/documentation/RealityKit/Entity/ChildCollection)

A collection of child entities.

[`protocol HasHierarchy`](/documentation/RealityKit/HasHierarchy)

An interface that provides access to a parent entity and child entities.

### Managing components

[`var components: Entity.ComponentSet`](/documentation/RealityKit/Entity/components)

All the components that an entity stores.

[`struct ComponentSet`](/documentation/RealityKit/Entity/ComponentSet)

A collection of components that an entity stores.

### Inspecting an entity

[`var scene: Scene?`](/documentation/RealityKit/Entity/scene)

The scene that owns the entity.

[`var name: String`](/documentation/RealityKit/Entity/name)

The name of the entity.

[`func findEntity(named: String) -> Entity?`](/documentation/RealityKit/Entity/findEntity(named:))

Recursively searches all descendant entities for one with the given
name.

[`var debugDescription: String`](/documentation/RealityKit/Entity/debugDescription)

A human readable description of the entity.

### Managing the entity’s state

[`var isEnabled: Bool`](/documentation/RealityKit/Entity/isEnabled)

A Boolean that you set to enable or disable the entity and its
descendants.

[`var isEnabledInHierarchy: Bool`](/documentation/RealityKit/Entity/isEnabledInHierarchy)

A Boolean that indicates whether the entity and all of its ancestors are
enabled.

[`var isActive: Bool`](/documentation/RealityKit/Entity/isActive)

A Boolean that indicates whether the entity is active.

[`var isAnchored: Bool`](/documentation/RealityKit/Entity/isAnchored)

A Boolean that indicates whether the entity is anchored.

### Synchronizing entities with other devices

[`struct SynchronizationComponent`](/documentation/RealityKit/SynchronizationComponent)

A component that synchronizes an entity between processes and networked
applications.

### Finding the nearest anchor

[`var anchor: (any HasAnchoring)?`](/documentation/RealityKit/Entity/anchor)

The nearest ancestor entity that can act as an anchor.

### Creating a collision shape

[`func generateCollisionShapes(recursive: Bool)`](/documentation/RealityKit/Entity/generateCollisionShapes(recursive:))

Creates the shape used to detect collisions between two entities that
have collision components.

[`func generateCollisionShapes(recursive: Bool, static: Bool)`](/documentation/RealityKit/Entity/generateCollisionShapes(recursive:static:))

Creates the shape used to detect collisions between two entities that
have collision components.

### Animating an entity

[`var availableAnimations: [AnimationResource]`](/documentation/RealityKit/Entity/availableAnimations)

The list of animations associated with the entity.

[`func playAnimation(AnimationResource, transitionDuration: TimeInterval, blendLayerOffset: Int, separateAnimatedValue: Bool, startsPaused: Bool, clock: CMClockOrTimebase?) -> AnimationPlaybackController`](/documentation/RealityKit/Entity/playAnimation(_:transitionDuration:blendLayerOffset:separateAnimatedValue:startsPaused:clock:))

Plays an animation with the specified options.

[`func playAnimation(AnimationResource, transitionDuration: TimeInterval, blendLayerOffset: Int, separateAnimatedValue: Bool, startsPaused: Bool, clock: CMClockOrTimebase?, handoffType: AnimationHandoffType) -> AnimationPlaybackController`](/documentation/RealityKit/Entity/playAnimation(_:transitionDuration:blendLayerOffset:separateAnimatedValue:startsPaused:clock:handoffType:))

Plays an animation with the specified options.

[`func playAnimation(AnimationResource, transitionDuration: TimeInterval, startsPaused: Bool) -> AnimationPlaybackController`](/documentation/RealityKit/Entity/playAnimation(_:transitionDuration:startsPaused:))

Plays the given animation on the entity.

[`func stopAllAnimations(recursive: Bool)`](/documentation/RealityKit/Entity/stopAllAnimations(recursive:))

Stops all playing of animations on this entity.

[`var defaultAnimationClock: CMClockOrTimebase`](/documentation/RealityKit/Entity/defaultAnimationClock)

Returns the default animation clock for this entity.

[`var parameters: Entity.ParameterSet`](/documentation/RealityKit/Entity/parameters)

Represents a reference to the parameters for a particular entity.

[`struct ParameterSet`](/documentation/RealityKit/Entity/ParameterSet)

Represents a reference to the parameters for a particular entity.

[`func playAnimation(named: String, transitionDuration: TimeInterval, startsPaused: Bool, recursive: Bool) -> AnimationPlaybackController`](/documentation/RealityKit/Entity/playAnimation(named:transitionDuration:startsPaused:recursive:))

Plays all the animations with the given name on the entity.

[`var bindableValues: BindableValuesReference`](/documentation/RealityKit/Entity/bindableValues)

[`subscript(BindTarget.EntityPath) -> Entity?`](/documentation/RealityKit/Entity/subscript(_:))

Resolves the entity from the given entity path.

### Animating and controlling characters

[`var characterController: CharacterControllerComponent?`](/documentation/RealityKit/Entity/characterController)

The character controller component for the entity.

[`var characterControllerState: CharacterControllerStateComponent?`](/documentation/RealityKit/Entity/characterControllerState)

The character controller state for  the entity.

[`func moveCharacter(by: SIMD3<Float>, deltaTime: Float, relativeTo: Entity?, collisionHandler: ((CharacterControllerComponent.Collision) -> Void)?) -> CharacterControllerComponent.CollisionFlags`](/documentation/RealityKit/Entity/moveCharacter(by:deltaTime:relativeTo:collisionHandler:))

Moves the character along a specified vector over a period of time.

[`func teleportCharacter(to: SIMD3<Float>, relativeTo: Entity?)`](/documentation/RealityKit/Entity/teleportCharacter(to:relativeTo:))

Moves the character instantly to a new position.

### Playing audio

[`func playAudio(AudioResource) -> AudioPlaybackController`](/documentation/RealityKit/Entity/playAudio(_:))

Prepares and plays a new audio playback instance on this entity.

[`func playAudio(configuration: AudioGeneratorConfiguration, Audio.GeneratorRenderHandler) throws -> AudioGeneratorController`](/documentation/RealityKit/Entity/playAudio(configuration:_:))

Prepares and plays a real-time audio playback instance.

[`func prepareAudio(configuration: AudioGeneratorConfiguration, Audio.GeneratorRenderHandler) throws -> AudioGeneratorController`](/documentation/RealityKit/Entity/prepareAudio(configuration:_:))

Prepares a real-time audio playback instances.

[`func prepareAudio(AudioResource) -> AudioPlaybackController`](/documentation/RealityKit/Entity/prepareAudio(_:))

Prepares an audio resource for playback.

[`func stopAllAudio()`](/documentation/RealityKit/Entity/stopAllAudio())

Stops playback for all audio on this entity.

[`var spatialAudio: SpatialAudioComponent?`](/documentation/RealityKit/Entity/spatialAudio)

The component that configures the spatial rendering of sounds from this entity.

[`var ambientAudio: AmbientAudioComponent?`](/documentation/RealityKit/Entity/ambientAudio)

The component that configures the ambient rendering of sounds from this entity.

[`var channelAudio: ChannelAudioComponent?`](/documentation/RealityKit/Entity/channelAudio)

The component that configures the channel-based rendering of sounds from this entity.

### Saving an entity and its descendants

[`func write(to: URL) async throws`](/documentation/RealityKit/Entity/write(to:))

Exports the entity as a RealityKit file to a location in the file system.

### Configuring accessibility features

[Improving the Accessibility of RealityKit Apps](/documentation/RealityKit/improving-the-accessibility-of-realitykit-apps)

Incorporate assistive technologies in your augmented reality app.

[`var isAccessibilityElement: Bool`](/documentation/RealityKit/Entity/isAccessibilityElement)

A Boolean value indicating whether the receiver is an accessibility
element that an assistive application can access.

[`var accessibilityLabelKey: LocalizedStringResource?`](/documentation/RealityKit/Entity/accessibilityLabelKey)

A succinct label that identifies the entity, in a localized string key.

[`var accessibilityCustomActions: [LocalizedStringResource]`](/documentation/RealityKit/Entity/accessibilityCustomActions)

An array of custom actions supported by the entity, identified by their localized string key.

[`var accessibilityCustomContent: [AccessibilityComponent.CustomContent]`](/documentation/RealityKit/Entity/accessibilityCustomContent)

The Custom Content API is useful for delivering accessibility information from complex data sets to your users in measured portions.
Using this API allows you to leverage assistive technologies to present only the accessible content your app’s users need, when they need it.

[`var accessibilityCustomRotors: [AccessibilityComponent.RotorType]`](/documentation/RealityKit/Entity/accessibilityCustomRotors)

An array of supported rotors.

[`var accessibilityLabelKey: LocalizedStringResource?`](/documentation/RealityKit/Entity/accessibilityLabelKey)

A succinct label that identifies the entity, in a localized string key.

[`var accessibilitySystemActions: AccessibilityComponent.SupportedActions`](/documentation/RealityKit/Entity/accessibilitySystemActions)

The set of supported accessibility actions.

[`var accessibilityTraits: UIAccessibilityTraits`](/documentation/RealityKit/Entity/accessibilityTraits)

The combination of accessibility traits that best characterize the entity.

[`var accessibilityValue: LocalizedStringResource?`](/documentation/RealityKit/Entity/accessibilityValue)

A localized string key that represents the current value of the entity.

[`var accessibilityDescription: String?`](/documentation/RealityKit/Entity/accessibilityDescription)

A longer description of the entity for use by assistive technologies.

[`var accessibilityLabel: String?`](/documentation/RealityKit/Entity/accessibilityLabel)

A succinct label that identifies the purpose of the image.

[`var accessibilityDescription: String?`](/documentation/RealityKit/Entity/accessibilityDescription)

A longer description of the entity for use by assistive technologies.

### Comparing entities

### Creating an entity from data

[`convenience init(from: Data, named: String?, contentType: UTType) async throws`](/documentation/RealityKit/Entity/init(from:named:contentType:))

Creates an entity by asynchronously loading it from the in-memory contents of a file stored in a Data object.

### Writing an entity to a file

[`func write(to: URL, options: Entity.WriteOptions) async throws`](/documentation/RealityKit/Entity/write(to:options:))

[`static func write([Entity], to: URL, options: Entity.WriteOptions) async throws`](/documentation/RealityKit/Entity/write(_:to:options:))

Exports an array of entities as separate scenes within a single RealityKit file.

[`struct WriteOptions`](/documentation/RealityKit/Entity/WriteOptions)

A set of options that control how RealityKit writes entities to a reality file.

### Playing spatial audio

[`func playAudio(AudioResource, at: AVAudioTime) throws -> AudioPlaybackController`](/documentation/RealityKit/Entity/playAudio(_:at:))

Asynchronously prepares and plays a new audio playback instance at a specified time on this entity.

### Accessing components without animation

### Structures

[`struct Observable`](/documentation/RealityKit/Entity/Observable-swift.struct)

An observable interface to an entity’s properties and components,
enabling reactive updates using Swift’s Observation framework.

### Initializers

[`convenience(components:)`](/documentation/RealityKit/Entity/init(components:))

Creates an entity with multiple components.

[`convenience init(from: Data, named: String?) async throws`](/documentation/RealityKit/Entity/init(from:named:))

Creates an entity by asynchronously loading it from the in-memory contents of a file stored in a Data object.

### Instance Properties

[`var observable: Entity.Observable`](/documentation/RealityKit/Entity/observable-swift.property)

The version of the entity observable by Swift.

[`var pins: EntityGeometricPins`](/documentation/RealityKit/Entity/pins)

The entity’s geometric pins.

### Instance Methods

[`func applyTapForBehaviors() -> Bool`](/documentation/RealityKit/Entity/applyTapForBehaviors())

Apply a tap to an Entity or one of its ancestors to trigger a RealityComposer behavior if one is present.

[`func attach(GeometricPin?, to: GeometricPin)`](/documentation/RealityKit/Entity/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

### Type Methods

[`static func animate(Animation, body: () -> Void, completion: (() -> Void)?)`](/documentation/RealityKit/Entity/animate(_:body:completion:))

### Default Implementations

[CustomDebugStringConvertible Implementations](/documentation/RealityKit/Entity/CustomDebugStringConvertible-Implementations)

[Equatable Implementations](/documentation/RealityKit/Entity/Equatable-Implementations)

[Hashable Implementations](/documentation/RealityKit/Entity/Hashable-Implementations)

## Relationships

### Inherited By

[`PointLight`](/documentation/RealityKit/PointLight)

[`HasTransform`](/documentation/RealityKit/HasTransform)

[`HasSynchronization`](/documentation/RealityKit/HasSynchronization)

[`HasHierarchy`](/documentation/RealityKit/HasHierarchy)

[`DirectionalLight`](/documentation/RealityKit/DirectionalLight)

[`HasSceneUnderstanding`](/documentation/RealityKit/HasSceneUnderstanding)

[`TriggerVolume`](/documentation/RealityKit/TriggerVolume)

[`AnchorEntity`](/documentation/RealityKit/AnchorEntity)

[`SpotLight`](/documentation/RealityKit/SpotLight)

[`ModelEntity`](/documentation/RealityKit/ModelEntity)

[`HasAnchoring`](/documentation/RealityKit/HasAnchoring)

[`HasPhysicsMotion`](/documentation/RealityKit/HasPhysicsMotion)

[`BodyTrackedEntity`](/documentation/RealityKit/BodyTrackedEntity)

[`PerspectiveCamera`](/documentation/RealityKit/PerspectiveCamera)

[`ViewAttachmentEntity`](/documentation/RealityKit/ViewAttachmentEntity)

### Conforms To

[`CoordinateSpace3DFloat`](/documentation/Spatial/CoordinateSpace3DFloat)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`RealityCoordinateSpace`](/documentation/RealityKit/RealityCoordinateSpace)

[`Observable`](/documentation/Observation/Observable)

[`HasSynchronization`](/documentation/RealityKit/HasSynchronization)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`HasTransform`](/documentation/RealityKit/HasTransform)

[`EventSource`](/documentation/RealityKit/EventSource)

[`Sendable`](/documentation/Swift/Sendable)

[`Identifiable`](/documentation/Swift/Identifiable)

[`Copyable`](/documentation/Swift/Copyable)

[`CoordinateSpace3D`](/documentation/Spatial/CoordinateSpace3D)

[`Hashable`](/documentation/Swift/Hashable)

[`Equatable`](/documentation/Swift/Equatable)

[`Escapable`](/documentation/Swift/Escapable)

[`HasHierarchy`](/documentation/RealityKit/HasHierarchy)

---

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)