Composites
Spawn a tree of entities and components at runtime from a composite file
Spawn a composite
export async function spawnBarrel() {
const src = "barrel.composite";
// 1. Load the composite from its file
await engine.getCompositeProvider().loadComposite(src);
// 2. Spawn it: creates all its entities and components
const barrel = engine.addEntityFromComposite(src);
return barrel;
}Position a spawned composite
Current limitation: nested composites
Related pages
Last updated