Builtin Library
README.md
prefab.from_geometry (procNode)
A prefab of one entity drawing a geometry: a root entity record carrying the native Mesh and Material components, the reusable entity template a spawn copies. A spawned copy costs what a drawn mesh costs. Use it to turn one mesh a graph built into something the output node stands or the export node saves as a bundle. prefab.place puts it under an entity of another prefab at a local pose. The parts a graph builds and parents itself are elements: elements.entity makes one and elements.link parents it under another.
Inputs
geometry(Geometry). The mesh the entity draws. Its own material, the one geometry.set_material or instances.realize put there, is the one it draws with whenmaterialis left out; with neither, it draws with the default material.name(String, default "model"). The root entity's name, and the handle the name-resolving nodes (prefab.entity,prefab.parent,prefab.link,prefab.place) reach it by afterwards. An empty string takes "model".material(AssetRef<material>, optional). A reference to a material asset, writtenasset.resolve("<identity>", "material"), drawn with ahead of whatever the geometry itself carries.
Outputs
prefab(Prefab). One record: the root, itsecsholding aMeshrow (mesh, the geometry) and aMaterialrow (id, the material). Spawning (the output node,bundle.spawn) makes each into the native component it names, and exporting writes the geometry and the material as assets the saved rows name by guid.
local crate = g.prefab.from_geometry({ geometry = g.mesh.box({}), name = "crate" })