Skip to content
Konjure / spatial intelligence

spawn

← Builtin reference

Creates an entity with one record component and returns its opaque identity.

Signature

func spawn(component: C) -> Entity

The C placeholder means one concrete type value, never a trait or primitive. Entity creation is bounded and rejected when the machine has no remaining entity capacity.

Parameters

component: C
A constructed type value; traits and primitive values are rejected.

Returns

Entity

The new Entity identity.

Examples

Create an entity

A spawned component receives the first entity identity.

Tick 0 · 0.00 s⌘ / Ctrl + EnterThis device
main.kj
Loading the language runtime…
Output 0
No output.
Expected output
entity(1)

Rust definition

Rust interpreter builtin dispatch; Type is specialized from a concrete type argument.

See also