MeshedSnapshot

View source

Holds serializable persistence data for a Meshed component.

This value stores a handle snapshot rather than a live asset handle, so it can be persisted and later used to rebuild the component. It is not an ECS component.

Constructor


constructor(handle: HandleSnapshot)

View source

Creates persistence data for a mesh component handle.

The supplied HandleSnapshot is stored as-is; this constructor does not restore or clone a live handle.

Parameters

NameDescriptionDefault
handle

Snapshot created from a Meshed handle.

—

Properties


Methods


staticfromSnapshot(snapshot: MeshedSnapshot, world: World, sceneAssetId?: AssetId): Meshed

View source

Restores a live Meshed component from this persistence data.

This delegates to Handle#fromSnapshot and requires the world to contain an AssetServer resource. A string locator uses the server to load or reserve the asset; a numeric locator requires sceneAssetId and a matching scene asset mapping. If nested restoration returns undefined, this method still returns a Meshed whose handle is undefined; a missing server or asset pool throws.

Examples

const serial = MeshedSnapshot.serialize(Meshed.toSnapshot(meshed, world))
const restored = Meshed.fromSnapshot(MeshedSnapshot.deserialize(serial), world, sceneAssetId)

Parameters

NameDescriptionDefault
snapshot

Snapshot being restored.

—
world

World used to restore the handle.

—
sceneAssetId?

Owning scene ID for a scene-local handle index.

—

Returns

Component wrapping the restored handle; an unmapped numeric index produces a component whose handle is undefined.

staticdeserialize(value: MeshedSnapshotSerial, out?: MeshedSnapshot): MeshedSnapshot

View source

Rehydrates a MeshedSnapshot from plain persistence data.

The nested HandleSnapshot.deserialize call copies the serialized type and path or scene-local index into out.handle. It does not access a World or AssetServer; live-handle restoration happens only through Meshed#fromSnapshot.

Parameters

NameDescriptionDefault
value

Serialized handle snapshot.

—
out?

Snapshot object to populate.

...

Returns

The populated snapshot.