Skip to main content

ADD

Constant ADD 

Source
pub const ADD: FunctionDescriptor;
Expand description

Adds a record component to an existing entity.

C means a concrete type value. Adding a component that the entity already owns, or addressing a missing entity, rejects the current transaction.

§Signature

func add(entity: Entity, component: C) -> Unit

§Add a component

A new Sphere component becomes queryable on the entity.

let entity = spawn(Vec3 {});
add(entity, Sphere {});
print(has[Sphere](entity));