Skip to content

Changelog ​

What changed between runtime versions. Scripts pin to the version they were written against, so older experiences keep running unchanged. See the Migration Guide when you move an experience forward.

0.5.0 Beta ​

Texts a script writes, in the viewer's language, dynamic textures in a shader's named slots, compute shaders that bind by name, game controllers and spatial accessories, a camera that scripts can point, and particle emitters built in the editor.

New APIs ​

  • experience.language – the language the experience's texts show in, such as "de", or undefined when it has no translations. Pass it to Intl.NumberFormat or Intl.DateTimeFormat to format numbers and dates the way the viewer reads them. Set it to one of the experience's languages to switch every text at once, or to null to follow the device again.
  • experience.localize(name, values) – a shared text in the experience's language, with each ${placeholder} filled from values. Returns name and warns in the console when the experience has no shared text by that name.
  • scene.on('languageChange', fn) – runs fn when the experience switches its language, with the new language code in event.language. A text a script wrote stays in the language it was written in, so write it again here.
  • Compute shaders with a header – Kernel.fromAsset({ assetId }) loads one without a function name. kernel.run and mesh.runCompute then take parameters and bind buffers and textures by the names in the header. A kernel whose header states its dispatch.groups takes threadGroups to change them for one run.
  • Material.shaderTexture(name, texture) – binds a texture to a shader's named texture slot. A dynamic texture keeps updating there, so a video or the camera feed can drive a shader.
  • mesh.setShader(kernel, options) – runs a compute shader that updates elements on a mesh or a splat, every frame or once, in place of its Shader slot. setShader(null) stops it. Also on splat.
  • Material.transmission({ transmissionOptions }) – a material that refracts what is behind it, like glass, water or ice, as the editor's Transmission kind. transmissionOptions({ ior, thickness, roughness, tint, … }) sets its settings; each key is optional. Currently refracts on iPhone, iPad and Mac.
  • Texture.fromAsset(idOrName) – a texture from Library > Textures, by id or name, to read in a kernel or a material.
  • mesh.setParameter(name, value, typeHint?) and splat.setParameter(...) – change a parameter of the shader running on a mesh or a splat, the Shader slot's or one set with setShader, until the object next loads. Takes the same values as Material.setParameter and warns in the console for a name the shader doesn't have.
  • mesh.recalculateNormals() – recomputes the mesh's normals once from its triangles, after runCompute or writeVertices moved the points. setShader(kernel, { recalculateNormals: true }) does it after every run, as the Shader slot's Recalculate Normals does.
  • texture.setParameter(name, value, typeHint?) – changes a parameter of the shader that draws a Library texture, on the running copy only. Takes the same values as Material.setParameter. See the example.
  • scene.getEffect(id) – a shader effect of the scene as an Effect, with setParameter(name, value, typeHint?) and shaderTexture(name, texture) as on a material. Changes reach the running effect only.
  • Texture.image, Texture.video and Texture.background take scale, the picture's size as a fraction of the source's, and steps, processing run in order: { blur }, { thresholdToZero }, { radialZoomBlur } or { shader }.
  • Texture.background() – the scene background as a texture, the camera image in AR and the scene's background on Mac. It is the new name of Texture.cameraFeed(), which keeps working.
  • setShader(kernel, { inputTextures }) on a mesh or a splat – fills the shader's texture parameters by name, each with a texture's .read.
  • scene.setAmbientOcclusion({ radius, strength }) – darkens creases, corners and the ground under objects, as the scene's Ambient Occlusion setting does. null switches it off. Check environment.features.has('ambientOcclusion') first. It is false on Apple Vision Pro.
  • environment.features.has('background') – whether Texture.background() shows anything here. It is the new name of 'cameraFeed', which keeps working; environment.features.list() reports 'background'.
  • entity.representation.particles – a particle emitter in the running scene, or null for any other kind of object. burst() releases a burst of particles at once and isEmitting starts or stops new particles. On an emitter built in the editor, birthRate, speed, size, lifeSpan, color, endColor and acceleration change how it looks while the experience runs; on an imported particle file they read as null. Changes last until the experience ends and never alter the saved experience.
  • boundingBox and worldBoundingBox on Entity – the size and position of a part of a model that findChild returned, such as one room inside a building.
  • safeAreaPadding on every UI view – edges whose padding grows by the safe area, such as safeAreaPadding: ['bottom']. In a panel anchored with Anchor.screenSpace({ respectsSafeArea: false }), a header image can reach the screen edge while text and buttons stay clear of the status bar and the home indicator.
  • createPanel(content, { presentation: 'projected' }) – draws the panel over the scene on iPhone, iPad and Mac: flat, facing the viewer, the same size at any distance and never hidden by objects, as the editor's Presentation › Projected does. Apple Vision Pro shows it in the world.
  • UI.carousel(options) – a row or column of views that scrolls and selects the one in the middle, with on('valueChanged', fn) for the selected index, on('scroll', fn) for the position while it moves, and scrollTransition({ scale, opacity, rotation, tilt, offset }) to shrink, fade, turn or move children by their distance from the middle. itemSize: 'matchLargest' makes every child as long as the longest. See Room picker carousel.
  • experience.openScreen(name) and experience.closeScreen(name) – show and close one of the experience's screens, made in the editor's Screens section, with its own Reveal and Removal Animation. openScreen resolves with the screen, so a script can fill in its views. Without a name, closeScreen closes the screen whose event ran the script.
  • rep.guideTo(target, { color }) on RepresentationEntity – points the direction indicator at a part of a model that findChild returned, or at the whole object, in any colour. rep.guideTo(null) hides it. See Guide to a room.
  • scene.cancelNamedActions(name) – stops every running Group or Sequence with that name, as the editor's Cancel Named Actions action does. It also stops a Group or Sequence the calling script runs inside, when that has the same name. See Stop the previous room's tour.
  • scale, rotation, offsetX and offsetY on every UI view – scale and turn a view about its centre and move it, without changing the panel's layout. Works with animateTo.
  • view.on('pinch' | 'pan' | 'rotate'), and on('tap') on every kind of view, in panels on the screen on iPhone, iPad and Mac. The event has the gesture's phase, scale, rotation or translation, velocity, and positions in points on the view.
  • iconPointSize and iconOffset on UI.button – the icon's size, and [x, y] points that move it without resizing the button, for centring a glyph by eye.
  • carousel.scrollWith(e) – a pan that began elsewhere, such as on the scene, scrolls the carousel like a swipe on it.
  • e.beganOnDraggable on scene.on('pan') – the pan began on an object the viewer can drag, or on a panel in 3D.
  • UI.annotation(options) – a marker pinned to a point that opens a card when tapped, with isExpanded to open or close it and on('toggled', fn) when the visitor does. See One hotspot open at a time.
  • repeatCount and repeatMode in a view's animateTo, as in an object's animateTo: repeatCount: -1 loops until view.stopAnimations() stops it, and repeatMode: 'autoReverse' plays every other repeat backwards.
  • prominence: 'expressive' in a UI.button's style – Liquid Glass in panels on the screen, tinted with the button's backgroundColor, or blue for appearance: 'primary' and red for 'destructive'. In a panel in 3D the button keeps its fill.
  • UI.animate(changes, options) – the changes a script makes to panel views inside changes animate: a stack opens or closes around views shown or hidden, new views fade in, opacity eases, and the panel grows or shrinks with them. Takes the same timing options as animateTo and resolves when the animation finishes. See Animate changes.
  • environment.accessibility – reduceMotion is true while the viewer has asked for less motion, and on('change', fn) runs fn when that changes. Scenery plays animations as authored, so check it before starting a loop or a shake.
  • background, overlay and placement on every UI view – views drawn behind or in front of a view, without changing its size, placed by an alignment and an anchor such as placement: { alignment: 'topTrailing' }.
  • view.add(newView, { to, at }), view.remove(), and view.background / view.overlay to read or replace those lists – change a panel's views while it shows; the other views keep their state. See Add and remove views and Count badge on a button.
  • view.copy() and view.findView(query) – copy a view authored in the editor, as often as needed, and find views inside each copy. Build a list from one sample row. See List from one sample row.
  • Colour and shape shorthand in a UI view's style – foregroundColor: '#FF3B30', { light, dark }, and shape: 'capsule' or a corner radius.
  • view.enablePinchZoom({ minScale, maxScale, releaseBehavior }) – two fingers zoom the view about the point between them, and it springs back when they lift. See Zoomable room photo.
  • scene.gameController – the connected game controllers: gamepads on every platform, and spatial controllers on Apple Vision Pro. controllers lists them, and on('connect' | 'disconnect') reports changes, including controllers connected before the script subscribed.
  • GameController – one connected controller, with id, kind, hand, name and isConnected. buttons and sticks hold its current state, updated every frame before render; triggers report an analog value from 0 to 1. on('button' | 'stick') fires on changes, with a phase of 'began', 'changed' or 'ended' for buttons and an optional { name, phase } filter. pulse(intensity, seconds) plays a haptic pulse.
  • scene.camera – point the camera where the experience drives its own, on the Mac and in the preview outside AR. follow(target, options) keeps an object in view while the viewer can still orbit and zoom; lookAt(target, options) turns toward an object from where the camera stands or from a given point; release() hands the camera back. kind tells the two cases apart and mode reports what the last call set up. Angles are in degrees, distances in metres, damping in seconds. In AR the calls take effect once the view leaves AR.
  • scene.camera.gamepad – move and orbit choose which game controller inputs keep driving the camera, so a script can take the left stick for a character and leave the right stick orbiting.
  • gameController – a new feature flag for environment.features.has(...): whether controller input reaches scripts here.
  • cameraControls – a new feature flag: whether scene.camera can point the camera. false on Apple Vision Pro, where the wearer's head is the camera.
  • Spatial controllers and styluses on Apple Vision Pro – kind is 'spatialController' for a tracked controller such as a PlayStation VR2 Sense controller, and 'stylus' for a spatial stylus such as Logitech Muse. Both report hand; a spatial controller is announced only once its side is known, so hand is set from connect on. aim and grip read their poses in the scene, each with position, rotation, velocity and angularVelocity, or null while untracked. A stylus reports tip with the pressure as value, primaryButton and secondaryButton.
  • Anchor.accessory(options) – anchors an object to a stylus tip or a controller's aim or grip, with kind, hand, location, offset, smoothing and trackingMode.
  • accessoryTracking – a new feature flag: whether aim, grip and accessory anchors track here.
  • t.physics({ shape: { capsules: [...] } }) – a collision shape built from capsules, each { from, to, radius }, for rings, chains and other shapes a box or hull fits badly.

Changed ​

  • Material.setParameter(name, value) – a Transform sets a Matrix parameter to its 4×4 matrix.
  • Texture.cameraFeed() – on Mac it now shows the scene's background, and environment.features.has('background') is true on Mac. A material sampling it at context.backgroundUV lines up with what is behind it.
  • createPlane(orientation, width, height, cornerRadius, subdivisions) and createSphere(radius, subdivisions, options) – optional subdivisions divide the surface into finer cells, so a shader can bend and ripple it smoothly. A plane takes one number for both sides or [x, y]. Leave it out for the standard plane and sphere; createSphere(radius, options) still works.
  • mesh.runCompute(kernel, options) and setShader(kernel, options) – an update shader's uv element field reads and writes the mesh's uv0 attribute. setShader adds a normal, tangent, uv or color attribute the mesh lacks and keeps its current vertices.
  • mesh.runCompute(kernel, options) and setShader(kernel, options) – an update shader can read the read-only restPosition element field: each point's position from before any shader moved it, kept when setShader swaps the shader. On a splat it works through setShader; with kernel.run bind your own restPosition buffer in outputBuffers.
  • animateTo takes spring: { duration, bounce } in its options, as animateValue does, and velocity: { name: speed } to carry on from a gesture's speed.
  • spring.velocity in animateValue – the speed the value starts with, so a spring carries on from a flick instead of starting at rest.
  • Springs end exactly on their target, and a carousel in a panel in 3D glides to the selected child like one on the screen.
  • animateValue warns in the console when from and to are different kinds of value, which animates nothing, and when curve names an unknown curve, which plays linear.

Fixed ​

  • A parameter of a Library texture or of a mesh's Shader slot that is bound to a variable now follows the variable, as it does on materials and effects. It read its default before.

0.4.0 Beta ​

Calling an API that needs a key, without the key being in the experience.

New APIs ​

  • secret – an option on http.request. Name a credential the experience binds and Scenery makes the request itself, adding the key on the way out, so it never reaches a viewer's device. The key is stored on your account and tied to the API's address, so it is only ever sent there and you can replace it without touching a script. Works with any API that takes its key in a header. Add one in the editor under Secrets. Cannot be combined with token or username.
  • coordinateSystem – an option on createSplat: the axes the file stores its splats in. Pass 'rdf' for an export from SuperSplat, Niantic's ply_to_spz or another PLY-based tool that appears upside down. Defaults to 'rub', the axes the SPZ format specifies.

Errors worth branching on ​

A rejected call carries code and reason. Two share the code resource-exhausted and want opposite handling: owner_busy is transient and worth retrying shortly, while ceiling_reached means the secret has spent its daily limit and carries details.limit and details.resetAt.

The vendor's own refusal is not an error. An API returning 429 or 400 arrives as an ordinary response with that status, so a script that only wraps the call in try will miss it. See handling a failed call.

Fixed ​

  • UI.toggle – a panel that contains one loads, from Scenery 1.3.1 on, in every runtime version. Before, the whole panel failed to load.

0.3.0 Beta ​

Lights, the two scene-wide looks that go with them, and GPU access to splat captures and mesh instances. Additive: nothing in 0.2.0 changed.

New APIs ​

  • Splat – entity.representation.splat reaches a Gaussian splat capture's per-splat data: count, boundingBox, sphericalHarmonicDegree, and the five attributes. Each attribute vends .read and .write tokens for a compute kernel, so reveals, dissolves and interactive effects run on the GPU rather than being rebuilt in JavaScript. null on any other representation and wherever captures are unavailable.
  • InstanceData – entity.instances and rep.instances hand the mesh instancing transform buffer to a kernel, so thousands of copies can move per frame without rebuilding the transform list.
  • EngineBufferBinding – the token type both of those return, alongside the existing TextureBinding.
  • Lights – createSpotLight(...), createPointLight(...) and createDirectionalLight(...) build light objects the same way createBox builds a shape, so they take name, anchor and transform like anything else. Colour, intensity, cone angles, attenuation, shadows and a projected texture are set at creation. projectedTexture takes an asset id, a URL, or a handle from Texture, so a spot can project a video, the camera feed or a compute kernel's output as easily as a stored image.
  • Light – the live handle, entity.representation.light. Reading and writing intensity, color, innerAngle, outerAngle, attenuationRadius, falloffExponent, projectedTextureOffset, projectedTextureScale and projectedTextureRotation takes effect on the next frame, which makes a pulsing lamp or a drifting pattern one animateValue away. Writes are runtime state and do not change the saved experience.
  • scene.setBloom(...) – make bright pixels glow, scoped to the whole scene or to objects that opt in. null switches it off.
  • scene.setToneMapping(...) – set the scene's tone curve (exposure, toe, shoulder). null returns to the platform default.
  • .revealAnimation(...) / .removalAnimation(...) – choose how a created object animates in and out, using the same four styles as the editor's Reveal and Removal Animation pickers: 'default', 'disabled', 'fade', 'fadeAndScale'. .revealAnimation(false) is shorthand for no animation, which is what a script that runs its own reveal wants. Previously reachable only through the untyped t.set('modelAdjustments.revealAnimation', …).
  • instances.meshToLocal / instances.localToMesh – the conversion between the instance buffer's units and metres, as 16 numbers in column-major order for a kernel's uniforms. The buffer holds the instanced mesh's own units, which are rarely metres: a model scaled to a fitting box measured 407 buffer units to the metre, so a copy placed at 0.82 m sits in the buffer at 335. A kernel that adds a fixed offset has to convert, or it moves things by the wrong amount and usually looks frozen. Identity for a primitive.
  • .hideByDefault(...) – create an object hidden, so a script can prepare it before anyone sees it, then bring it up with scene.toggle([entity], true). Mirrors the editor's Hide By Default toggle. It still loads: the representation is built and the physics body precomputed, the object is simply not shown and its physics stays paused.

Feature flags ​

Seven additions to environment.features, each with a support condition a script can actually hit: softShadows, shadowCascades, projectedLightTexture, surroundingsLight, bloom, toneMapping, splats. Bloom wants a capable GPU as well as a recent OS, the surroundings light exists on Apple Vision Pro alone, and splats render on devices only, never in a simulator. Gate on them and a portable script degrades instead of looking broken.

Changed ​

  • Value animations run in step with rendering. animateValue used to be driven by its own display refresh clock, separate from the one the scene renders on. That clock could be served at a fraction of the frame rate, giving a visibly coarse animation, or at twice it, computing values no frame ever painted. It now ticks once per rendered frame, so onUpdate and scene.on('render') see the same frames. An animation also starts at its from value rather than a frame or two along.

    Two consequences worth knowing. A value animation now pauses with the experience and resumes where it froze, instead of running on through a pause and jumping. And on Apple Vision Pro it pauses while the headset has no position, such as while an immersive space is opening or tracking is interrupted.

    wait() is unchanged and still runs on a timer, so it keeps counting through a pause. A wait and an animation completion started together can therefore finish in the other order if the experience is paused in between.

  • traits.pivot takes all six faces. Alongside "top", "center" and "bottom" it now accepts "left", "right", "front" and "back". "back" seats a model flat against an upright surface the way "bottom" stands one on a floor, which is what content placed on a wall needs: left on its own origin it straddles the surface, so half of anything solid ends up inside the wall. Existing values are unchanged.

  • rep.setInstances needs a single mesh. A primitive always is one; a model is once its Flatten adjustment is on, which loads it collapsed the way every other engine expects for instancing. An unflattened model with several meshes is now refused, with the console naming them, instead of quietly writing a separate buffer per mesh that no kernel could read back as one. Flattened models also place their copies correctly now: the transform the mesh file used to position its geometry was being discarded, which drew every copy at the raw size.

  • Kernel bindings keep the order you wrote them. Entries in inputBuffers, outputBuffers, inputTextures and outputTextures take kernel slots in the order they appear in the object. They previously came out in an unspecified order, which only ever looked right because no example bound more than one entry per map. One caveat is JavaScript's, not ours: keys that look like integers ({ 2: …, 0: … }) sort numerically ahead of everything else, so name your slots.

  • A binding that cannot be honoured now cancels the dispatch instead of skipping the entry. Skipping left its slot unclaimed, which slid every later buffer into the wrong one, so a single destroyed handle silently corrupted the whole pass. Binding past the GPU's 31-slot limit now says so as well.

Fixed ​

  • buffer.readSync() waits for the GPU. It read shared memory without waiting for the dispatch that was writing it, so the marching-cubes pattern of dispatching and then reading the triangle counter got the previous frame's value. buffer.writeSync(...) waits too, so reseeding a counter between passes cannot land under a running kernel.
  • A partial transform in a declarative options object (transform: { rotation: … }) no longer throws on the fields it omits.
  • environment.location.watch's onError fires. It never did, so a withdrawn permission or a Core Location failure went unnoticed. It now receives "denied" or "unavailable" (Scenery 1.2.2).

0.2.0 Beta ​

A large, mostly additive release. Highlights:

New APIs ​

Changed ​

0.1.0 ​

Initial scripting runtime.