Builtin Library
README.md
entityOps.fromAsset
Instantiate an existing asset into the scene — resolution-first: pass a name / path / identity string, the tool resolves it and reports the canonical asset it hit, so you never need to know the exact identity up front.
entityOps.fromAsset("@builtin::avatars.humanoid")
entityOps.fromAsset("oak_chest", { type = "bundle", position = {2, 0, 0} })
entityOps.fromAsset("gold", { type = "material" })
entityOps.fromAsset("/zero/source/generated/meshes/a_statue.bundle", { link = false })
Dispatch by resolved category:
- bundle / avatar — instantiated via its own
:instantiate().link(default true) keeps the live Asset-component link so the source drives the hierarchy;link = falsebakes the hierarchy into the scene. - mesh — a renderable (Model + mesh Collider).
- material — a sphere carrying the material.
- texture — a plane sampling the texture (through a fresh unlit material, so it never rewrites another preview).
- anything else — instantiated through its own
:instantiate()when it has one, else a legible error.
type limits the asset search to one category (avoids name clashes).
position / rotation / scale place it; synced replicates gameplay
edits to peers. Returns { id, name, resolved = { category, identity, path } } — resolved is the canonical asset your string hit.
To spawn from hand-named components instead of an existing asset, use
entityOps.spawn.