Skip to main content

Assets

Frequently asked questions about prefabs, World Mesh, remote files, and scene hierarchy limits in SPECS Lenses.

Assets are managed in the Asset Browser in Lens Studio, where you import, organize, and change them. These are common questions about the assets a SPECS Lens uses.

Prefabs


When you create a SceneObject, adjust its transform, and then convert it into a prefab, the prefab stores the transform values it had when you created it. After that, applying an instance doesn't change the prefab's position and rotation. This prevents common mistakes when you apply or revert a whole prefab instance.


No. A prefab asset isn't a SceneObject until you instantiate it, so it has no components you can get. Changing the prefab asset directly changes the root prefab, and with it every instance. To access a prefab's components, instantiate it first.

World Mesh


SPECS builds the World Mesh from depth between about 0.5 m and 5 m from the device. How far it reaches in practice depends on the lighting and the surfaces around you. See World Mesh and Depth Texture.


The World Mesh can have gaps, and an object that falls through one keeps falling. To prevent this, add colliders to cover the gaps. For the best Lens performance, scan the room before the experience starts: for example, run World Mesh tracking in the background during a splash screen or introduction, then stop it once the scan is complete.


World Mesh tracking runs on the mesh's render object provider, so you turn it off through the RenderMeshVisual that shows the World Mesh. You can also turn it off on the Device Tracking component, with deviceTracking.worldOptions.enableWorldMeshesTracking.

@component
export class NewScript extends BaseScriptComponent {
@input
worldMeshVisual: RenderMeshVisual;
onAwake() {
let worldRenderProvider = this.worldMeshVisual.mesh
.control as WorldRenderObjectProvider;
worldRenderProvider.enableWorldMeshesTracking = false;
}
}

SPECS updates the World Mesh from new depth about 5 times a second (5 Hz).


The World Mesh uses 32-bit indices. Read them with getIndexBuffer(), which returns a Uint32Array for a mesh with 32-bit indices; extractIndices() supports only 16-bit indices and is deprecated. The World Mesh can hold millions of indices, so processing them in JavaScript or TypeScript costs SPECS a lot of performance. Read them only when you need to.

Remote Files


No. Remote Assets aren't available on SPECS. Host the files in Snap Cloud Storage instead, and load them while the Lens runs: create a resource from the file's URL with makeResourceFromUrl(), then load it with RemoteMediaModule, for example with loadResourceAsImageTexture(). See Download an Image from a URL.

If you're updating a Lens from Spectacles (2024) that uses Remote Assets, see Migrating a Lens to SPECS 27.

Scene Hierarchy


A scene supports up to 100,000 SceneObjects and 200,000 Components globally. A single object can have any number of children, but the hierarchy can be at most 256 levels deep. See Panels.