Builtin Library
README.md
entityOps.swap
Replace one entity with another entity that already exists in the
scene. The replacement is moved into the target's slot — same parent,
local position and rotation, the target's scale (keepScale = false
opts out) and name (keepName = false opts out) — and the target is
removed with its whole subtree.
entityOps.swap("DefaultBody", "my_knight")
entityOps.swap("placeholder_car", "sports_car", { keepName = false })
entityOps.swap("DefaultBody", "my_knight", { dryRun = true })
Both arguments are entity names or ids. dryRun = true reports what
would move and what would be removed without mutating.
To replace an entity with a content asset (a bundle/mesh/…) rather
than another scene entity, use entityOps.fromAsset (spawn) or
appearance.replaceWithContent (in-place slot swap).