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

# Scene

A container that holds the collection of entities that an AR view renders.

```
@MainActor @preconcurrency class Scene
```

## Overview

You don’t create a [`Scene`](/documentation/RealityKit/Scene) instance directly. Instead, you get the one and
only scene associated with a view from the [`scene`](/documentation/RealityKit/ARView/scene) property of an
[`ARView`](/documentation/RealityKit/ARView) instance.

![Block diagram showing the scene as a property of an AR view, with anchor](images/com.apple.RealityKit/Scene-1@2x.png)

To add content to the view’s scene, you first create and add one or more
[`AnchorEntity`](/documentation/RealityKit/AnchorEntity) instances to the scene’s [`anchors`](/documentation/RealityKit/Scene/anchors) collection.
Anchors tell RealityKit how to pin virtual content to real world objects,
like flat surfaces or images. You then add a hierarchy of other [`Entity`](/documentation/RealityKit/Entity)
instances to each anchor to indicate the geometry and behaviors that
RealityKit should render at a given anchor point.

## Topics

### Identifying the scene

[`name`](/documentation/RealityKit/Scene/name)

A name for the scene.

### Adding and removing anchors

[`anchors`](/documentation/RealityKit/Scene/anchors)

The collection of anchors contained in the scene.

[`addAnchor(_:)`](/documentation/RealityKit/Scene/addAnchor(_:))

Adds an anchor to the scene’s list of anchors.

[`removeAnchor(_:)`](/documentation/RealityKit/Scene/removeAnchor(_:))

Removes the specified anchor from the scene.

### Finding entities

[`findEntity(named:)`](/documentation/RealityKit/Scene/findEntity(named:))

Searches the scene’s anchor entity hierarchies for an entity with the
given name.

[`performQuery(_:)`](/documentation/RealityKit/Scene/performQuery(_:))

Returns all entities of the scene which pass the query.

[`findEntity(id:)`](/documentation/RealityKit/Scene/findEntity(id:))

Returns `Entity` with the given `Entity.ID` in the `Scene`.

### Detecting intersections

[`raycast(origin:direction:length:query:mask:relativeTo:)`](/documentation/RealityKit/Scene/raycast(origin:direction:length:query:mask:relativeTo:))

Performs a ray cast against all the geometry in the scene for a
ray of a given origin, direction, and length.

[`raycast(from:to:query:mask:relativeTo:)`](/documentation/RealityKit/Scene/raycast(from:to:query:mask:relativeTo:))

Performs a ray cast against all the geometry in the scene for a
ray between two end points.

[`convexCast(convexShape:fromPosition:fromOrientation:toPosition:toOrientation:query:mask:relativeTo:)`](/documentation/RealityKit/Scene/convexCast(convexShape:fromPosition:fromOrientation:toPosition:toOrientation:query:mask:relativeTo:))

Performs a convex shape cast against all the geometry in the scene.

[`pixelCast(from:to:)`](/documentation/RealityKit/Scene/pixelCast(from:to:))

Performs a ray cast against all the geometry in the scene for a ray
between two end points.

[`pixelCast(origin:direction:length:)`](/documentation/RealityKit/Scene/pixelCast(origin:direction:length:))

Performs a ray cast against all the geometry in the scene for a ray of
a given origin, direction, and length.

### Synchronizing entities with other devices

[`synchronizationService`](/documentation/RealityKit/Scene/synchronizationService)

The service to use for network synchronization.

### Publishing and subscribing to events

[`publisher(for:on:)`](/documentation/RealityKit/Scene/publisher(for:on:))

Generates a publisher for events of the specified type.

[`subscribe(to:on:_:)`](/documentation/RealityKit/Scene/subscribe(to:on:_:))

Subscribes to an event type, optionally limited to
events affecting a source entity or scene.

[`publisher(for:on:componentType:)`](/documentation/RealityKit/Scene/publisher(for:on:componentType:))

Returns a `Publisher` for events of the specified type in a `Scene`.

[`subscribe(to:on:componentType:_:)`](/documentation/RealityKit/Scene/subscribe(to:on:componentType:_:))

Subscribes to an event type, optionally limited to
events affecting a source entity or scene,
or limited to
a specific component type for component events.

### Accessing the command queue

[`commandQueue`](/documentation/RealityKit/Scene/commandQueue)

If this scene uses a MTLCommandQueue for rendering, returns it.



---

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)