Builtin Library
README.md
appearance.replaceWithContent
Replace one or many entities with a content asset — a bundle or mesh (a
generated .bundle, a library asset, a primitive). Each target entity
and its whole subtree is removed, and a fresh spawn of the content
takes its slot: same parent, local position, rotation, and name; scale
kept unless keepScale = false. Components on the removed entities do
not carry over — the result is the content, not an upgraded copy of the
target.
appearance.replaceWithContent("rider_blockout", "/zero/source/generated/meshes/a_snowboarder.bundle")
appearance.replaceWithContent({ "tree_1", "tree_2", "tree_3" }, "@libname::pine.bundle")
appearance.replaceWithContent({ "tree_1", "tree_2" }, "@libname::pine.bundle", { dryRun = true })
Targets are entity names or ids (one, or a list), scene.find
records, or a query. dryRun = true resolves everything and returns the plan
(which entities would be removed, how big each subtree is, what would
spawn) without mutating, so a batch can be validated before it runs.
To swap an entity for another entity that already exists in the scene,
use entityOps.swap. To change the mesh on existing entities without touching
the entity itself, use appearance.setModel.