Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit65083fe8f2

README.md

assets.fromEntity

Capture everything an entity is carrying at runtime as durable assets, and repoint the entity at them.

A procedural mesh (renderer.mesh.create) has no asset behind it, so anything keyed to that geometry — a GI bake, a saved scene — is session-only: reload and the mesh regenerates with a fresh identity, and the bake is gone. assets.fromEntity freezes every live runtime resource an entity's components hold — across the whole hierarchy, every resource field — into persistent assets in one call, and rewrites each field to point at the durable asset. Persistent references (already assets) are left untouched.

Resource fields are discovered generically from each component's registered schema, so any component carrying runtime content participates — it reifies all of an entity's runtime content, not one hard-coded type. A runtime resource shared across several fields is reified once and every field is repointed at the one asset.

Reify in edit mode to make content durable — in play mode the new assets land in the ephemeral runtime store.

assets.fromEntity()                        -- freeze every runtime resource in the scene
assets.fromEntity("cornellRoom")           -- freeze the cornellRoom hierarchy
assets.fromEntity(nil, { dryRun = true })  -- report what would be reified, write nothing

Returns { reified, skipped, failed }. The single-resource primitive is assets.new.