Scene Graph Prefabs
A prefab is a saved entity template — define it once (mesh + components + values) and stamp out many copies. Spawn enemies, pickups or props from one prefab so they all share setup.
In Scene Graph, a prefab is a saved entity template — a mesh plus its components plus its starting values, all bundled together. Build your goblin once, then drop it into your level as many times as you want.
Think of a blueprint that stamps out identical goblins. Each stamp carries the same mesh, the same health, the same behavior — change the blueprint and every copy updates.
Here our goblin_spawner stores EnemyType, a concrete entity type — that's the prefab. Spawn returns a fresh entity by writing EnemyType{}, which stamps out one copy. In OnBegin we call Spawn to get a brand-new goblin in the world.
Define the prefab once, then spawn copies whenever you need them — every enemy starts identical.
goblin_spawner := class:
EnemyType : concrete_subtype(entity)
Spawn() : entity =
EnemyType{}
OnBegin<override>()<suspends> : void =
NewGoblin := Spawn()
Build your own lesson with scene_graph_prefabs
Generate a personalized, compile-checked lesson grounded in this exact reference.
Build a lesson →