<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/DirectionalLightComponent/layers",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation25DirectionalLightComponentV6layersAA11RenderLayerV3SetVvp"
  },
  "title" : "layers"
}
-->

# layers

The layers this light illuminates.

```
var layers: RenderLayer.Set { get set }
```

## Discussion

A directional light illuminates an entity when the layers of the entity’s
[`RenderLayerComponent`](/documentation/RealityKit/RenderLayerComponent) intersect with this set. Entities without a
[`RenderLayerComponent`](/documentation/RealityKit/RenderLayerComponent) belong to [`defaultLayer`](/documentation/RealityKit/RenderLayer/defaultLayer), which is
the only member of `layers` by default.

Define your custom layers in an extension to [`RenderLayer`](/documentation/RealityKit/RenderLayer) and assign
them to lights and entities to control which lights affect which entities:

```swift
extension RenderLayer {
    static let hero = RenderLayer("com.myapp.hero")
}

var light = DirectionalLightComponent(color: .white, intensity: 10_000)
light.layers = [.hero]
```

Lights can be restricted by layer on devices with Apple6 GPU family feature support.

---

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)