<!--
{
  "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/LevelOfDetailComponent/addByResolutionMetric(to:levels:boundingBox:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation22LevelOfDetailComponentV21addByResolutionMetric2to6levels11boundingBoxyAA6EntityC_SaySayAIG8entities_AC17SelectionStrategyV0iJ0V31DirectionalSwitchingResolutionsV09switchingU0tGAA08BoundingN0VtFZ"
  },
  "title" : "addByResolutionMetric(to:levels:boundingBox:)"
}
-->

# addByResolutionMetric(to:levels:boundingBox:)

Adds Level of Detail configuration using resolution metric-based switching to an entity.

```
static func addByResolutionMetric(to entity: Entity, levels: [(entities: LevelOfDetailComponent.DetailLevel, switchingResolutions: LevelOfDetailComponent.SelectionStrategy.ResolutionMetric.DirectionalSwitchingResolutions)], boundingBox: BoundingBox)
```

## Parameters

`levels`

An array of levels, where each level specifies the entities to display and the level’s associated directional switching resolutions.

`boundingBox`

The bounding box of the entity used when calculating the switching resolutions .

## Discussion

Each level pairs a set of entities with a directional switching resolutions struct. Level 0 should have an empty directional switching resolutions struct.
Entities within a level are shown or hidden together.

Each entity in the provided levels is added as a child of the entity the component will be added to.
Children not included in any level are unaffected by LOD switching.

---

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)