Adds a record component to an existing entity.
Signature
C means a concrete type value. Adding a component that the entity already owns, or addressing a missing entity, rejects the current transaction.
Parameters
entity: Entity- An existing entity identity.
component: C- A type value whose type is not already attached.
Returns
UnitUnit after the component update is accepted.
Examples
Add a component
A new Sphere component becomes queryable on the entity.
main.kj
Loading…Drag to orbit · select to inspect
0 entities
Scene controls
Results
Loading the language runtime…
Output 0
No output.
State
Compile source to inspect its values.
TraceNo execution yet
- Executed source spans appear here.
Expected output
true
Rust definition
Rust interpreter builtin dispatch; Type is specialized from the concrete component type.
View Rust documentation →Support: runtime