---
title: "set(_:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/entity/componentset/set(_:)"
---

# set(_:)

Adds multiple components to the set, overriding any existing components of the same type.

## Declaration

```swift
@MainActor @preconcurrency func set(_ components: [any Component])
```

## Parameters

- `components`: An array of components to add.

## Discussion

Discussion If the input array includes multiple components of the same type, the set adds the component with the highest index. This is because the set can only hold one component of each type.
