---
title: "addByScreenArea(to:levels:)"
framework: realitykit
role: symbol
role_heading: Type Method
path: "realitykit/levelofdetailcomponent/addbyscreenarea(to:levels:)"
---

# addByScreenArea(to:levels:)

Adds Level of Detail configuration using screen area-based switching to an entity.

## Declaration

```swift
static func addByScreenArea(to entity: Entity, levels: [(entities: LevelOfDetailComponent.DetailLevel, minArea: Float)])
```

## Parameters

- `levels`: An array of levels, where each level specifies the entities to display and the minimum projected screen area (0.0-1.0) at which they are visible.

## Discussion

Discussion Each level pairs a set of entities with a minimum screen area threshold. Entities within a level are shown or hidden together. Thresholds must be in descending order and in the range [0.0, 1.0]. 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.

## See Also

### Creating a component

- [init(levels:switchingAt:)](realitykit/levelofdetailcomponent/init(levels:switchingat:).md)
- [addByCameraDistance(to:levels:)](realitykit/levelofdetailcomponent/addbycameradistance(to:levels:).md)
- [addByResolutionMetric(to:levels:boundingBox:)](realitykit/levelofdetailcomponent/addbyresolutionmetric(to:levels:boundingbox:).md)
