Skip to content

Environment

Properties

deviceCategory

  • Type: string
  • The device form factor: "handheld" (iPhone, iPad), "spatial" (Apple Vision Pro and other headsets), or "desktop" (Mac, desktop web). Prefer this over hostingPlatform when branching on the interaction model rather than the exact OS – e.g. screen gestures exist on handheld and desktop but not spatial, where input is the user's eyes and hands.

Example:

javascript
if (environment.deviceCategory === 'spatial') {
    showControlPanel();   // drive interaction from UI, not screen gestures
}

features

  • Type: EnvironmentFeatures
  • Runtime + device capability registry. Authors query by string – environment.features.has('compute') – to branch on whether the current platform supports a given feature. Mirrors WebGPU's adapter.features.has(...) shape so portable scripts read the same on both backends.

Example:

javascript
if (environment.features.has('compute')) {
    mesh.runCompute('advect', { uniforms });
}

hostingPlatform

  • Type: string
  • The platform running the experience: "iOS", "macOS", "visionOS", or "web"

isEditing

  • Type: boolean
  • true when the experience is running inside the Scenery editor's scene preview, false during normal playback. Lets scripts gate debug overlays, skip intros, or auto-fill placeholder state while the author is iterating.

Example:

javascript
// Show a debug HUD only while editing.
if (environment.isEditing) {
    scene.findEntity('debug-hud').isEnabled = true;
}

locale

  • Type: string
  • User's locale in BCP 47 format, e.g. "en-US", "de-DE"

location

  • Type: Location
  • The user's device location. Coarse reads ride the base grant; the precise tier is opted into explicitly. See LocationJSExports.

Example:

javascript
await environment.location.requestAccess();
const here = await environment.location.current();

systemOSVersion

  • Type: string
  • Operating system version string, e.g. "18.0" or "2.0"