BabylonJS/Babylon.js · error
XRSession.resumeDepthSensing is not supported by this XR run
Error message
XRSession.resumeDepthSensing is not supported by this XR runtime.
What it means
XRSession.resumeDepthSensing is optional in the WebXR depth-sensing spec. Babylon verifies `typeof session.resumeDepthSensing === "function"` and throws this Error when the runtime, despite having a live session, does not implement resume support. It is a capability error from the browser/runtime, not user code.
Source
Thrown at packages/dev/core/src/XR/features/WebXRDepthSensing.pure.ts:574
if (typeof session.pauseDepthSensing !== "function") {
throw new Error("XRSession.pauseDepthSensing is not supported by this XR runtime.");
}
return await session.pauseDepthSensing();
}
/**
* Resumes depth sensing for the active XR session.
* @returns A promise that resolves when the native resume operation completes.
* @throws If there is no active XR session or resuming depth sensing is not supported by the runtime.
* @see https://immersive-web.github.io/depth-sensing/
*/
public async resumeDepthSensingAsync(): Promise<void> {
const session: IWebXRDepthSensingSession | undefined = this._xrSessionManager.session;
if (!this._xrSessionManager.inXRSession || !session) {
throw new Error("Resuming WebXR depth sensing requires an active XR session.");
}
if (typeof session.resumeDepthSensing !== "function") {
throw new Error("XRSession.resumeDepthSensing is not supported by this XR runtime.");
}
return await session.resumeDepthSensing();
}
/**
* Latest cached InternalTexture which containing depth buffer information.
* This can be used when the depth usage is "gpu".
* @deprecated This will be removed in the future. Use latestDepthImageTexture
*/
public get latestInternalTexture(): Nullable<InternalTexture> {
if (!this._cachedWebGLTexture) {
return null;
}
return this._getInternalTextureFromDepthInfo();
}
/**
View on GitHub (pinned to 0592b347b8)
Solutions
- Feature-detect `typeof session?.resumeDepthSensing === "function"` before offering resume in UI.
- Catch the error and fall back to re-enabling depth sensing via session recreation, or continue without resume.
- Update the device runtime/browser to one implementing the full depth-sensing pause/resume API.
- Avoid relying on pause/resume in code that must run on all WebXR devices.
Example fix
// before
await depthSensing.resumeDepthSensingAsync();
// after
const session = xrSessionManager.session;
if (typeof session?.resumeDepthSensing === "function") {
await depthSensing.resumeDepthSensingAsync();
} else {
console.warn("resumeDepthSensing unsupported by this runtime");
} Defensive patterns
Strategy: type-guard
Validate before calling
const canResume = typeof xrSessionManager.session?.resumeDepthSensing === "function";
if (!canResume) { /* hide resume control or fallback */ } Type guard
function supportsResumeDepthSensing(session: XRSession | undefined): session is XRSession & { resumeDepthSensing(): Promise<void> } {
return typeof session?.resumeDepthSensing === "function";
} Try / catch
try {
await depthSensing.resumeDepthSensingAsync();
} catch (e) {
if (String((e as Error).message).includes("not supported by this XR runtime")) {
console.warn("resumeDepthSensing unsupported; continuing without resume");
} else { throw e; }
} Prevention
- Feature-detect resumeDepthSensing per session
- Do not assume symmetric pause/resume support across runtimes
- Fall back to session recreation if resume is essential
- Pin and test against the device browsers your users actually run
When it happens
Trigger: Calling resumeDepthSensingAsync() on a session whose XRSession lacks the resumeDepthSensing method (runtime supports depth sensing but not pause/resume controls).
Common situations: Older or partial depth-sensing implementations in headset browsers; experimental builds with different API surface; polyfills/emulators missing the optional methods; spec changes between draft and shipped versions.
Related errors
- XRSession.pauseDepthSensing is not supported by this XR runt
- Deleting persistent anchors is not supported in this environ
- XRCompositionLayer.${control} is not supported by this XR ru
- Anchors not enabled in this environment/browser
- Persistent anchor enumeration is not supported in this envir
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/e07e8a535f0f6c12.
Report an issue: GitHub.