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

# set(_:)

Adds a new component to the set, or overrides an existing one.

## Declaration

```swift
@MainActor @preconcurrency func set<T>(_ component: T) where T : Component
```

## Parameters

- `component`: The component to add.

## See Also

### Updating the set

- [set(_:)](realitykit/entity/componentset/set(_:)-2qzsc.md)
- [remove(_:)](realitykit/entity/componentset/remove(_:).md)
- [removeAll()](realitykit/entity/componentset/removeall().md)
