Contents

Entity.ComponentSet

A collection of components that an entity stores.

Declaration

@MainActor @preconcurrency struct ComponentSet

Overview

A ComponentSet represents all the components that an entity holds. Use this set to add, remove, and update components on an entity. This set can hold one component of each type.

Access the ComponentSet of an Entity using its components property.

ComponentSet conforms to Sequence, allowing you to iterate over it to access and use each component, as the example below shows:

for component in entity.components {
    print(component)
}

Topics

Updating the set

Accessing members

Checking for membership

Instance Properties

Instance Methods

Subscripts

See Also

Managing components