Skip to main content

Troubleshooting

Find the problem you see, then check its causes in order.

Starting a Session​

ProblemCauseFix
VR or AR is never available, and the button to enter it never showsThe page isn't in a secure contextServe it over HTTPS, or from localhost. See Testing on a Device
The page is in an iframe that doesn't allow XRAdd allow="xr-spatial-tracking" to the <iframe>. In debug builds, the engine logs a warning when it skips checking availability for this reason
The graphics device uses WebGPU, in a browser that can't present WebGPU to a headsetUse WebGL 2. See Choosing a Graphics Device
The device doesn't support the session type, such as AR on an Apple Vision ProSee Platforms
The code checked isAvailable once, as the application startedThe answer arrives asynchronously. Follow the available event. See Checking Availability
The application has no XR manager, so app.xr is nullAdd options.xr = XrManager to the AppOptions of an application created with AppBase
The session doesn't start when the button is selectedThe session was requested outside the handler of a user action, such as after an await or from a timerCall startXr, or fire the event that starts the session, in the click handler itself
It asks for a reference space that the device doesn't support, such as bounded-floorStart with local-floor. Pass a callback to startXr to see the error. See Reference Spaces
A session is already running or startingOnly one session can run at a time. The callback is passed XR session is already started or XR session is already starting
A feature such as plane detection is unavailable during the sessionThe session was started without the option that asks for itPass the option to startXr. The XrSession script starts sessions without options. See Options and Features
The device or the user didn't grant itCheck app.xr.session.enabledFeatures, and see Platforms

In the Session​

ProblemCauseFix
Setting the camera's position or rotation has no effectThe headset sets the camera's local position and rotation every frameMove the camera's parent, the rig. See The Camera and Its Rig
The user is too high, too low or inside the floorThe session uses local space, whose origin is at the user's headUse local-floor, whose origin is on the floor
The rig isn't on the floor of the scenePut the rig at the height of the floor. The XrSession script puts it at y = 0 when a session starts
The user starts in a different place, or facing another way, from the page's viewThe XrSession script moves the rig below the camera, facing where it facesPlace and turn the camera, before the session starts, where the user should start
The camera doesn't return to where it was after a sessionNothing restores it, unless the XrSession script is on the rigAdd XrSession, or save and restore the camera and rig yourself in start and end handlers
Objects disappear when brought close to the eyesThe camera's near clip distance is too largeSet nearClip to between 0.01 and 0.1
The button that enters XR stays hidden after a session endsIts end handler checks app.xr.active, which is still true while end handlers runShow the button in the end handler without checking active, as Getting Started does. See Ending a Session
The application keeps running behind the system menuIt doesn't react to the session's visibilityPause it on the visibility:change event. See Visibility

Input​

ProblemCauseFix
No controllers or hands are drawnNothing draws them: the engine reports their poses, but doesn't draw modelsAdd the XrControllers script to the rig. See Controller Models
XrControllers can't download the modelsIt loads them from a CDN, so the device needs internet access. Set its basePath attribute to host the models yourself
XrControllers was added during the sessionIt only draws the input sources that are added after it starts. Add it before the session starts. XrNavigation is the same
Controllers are drawn in the wrong placeTheir models aren't children of the rig, and are placed with local posesUse world positions and rotations, getPosition() and getRotation(), or add the models under the rig. See Tracking Space
getPosition() and getRotation() return null for a handTracked hands have no grip poseUse the poses of the hand's joints, such as its wrist. See Joints
Reading a thumbstick gives undefinedThe input source is a hand, or a controller without a thumbstick, and its gamepad leaves the axes outCheck the length of axes, or read it with ?? 0. See Buttons and Thumbsticks
Selecting a button or menu item also teleports the userXrNavigation teleports at the end of every select on valid groundTurn teleporting off while a menu is open or a ray points at the interface. See Teleporting and Menus
Teleports land behind walls, or fall through stepsThe castRay function returns null for walls, so the arc carries on, or casts from where the last segment endedSee Landing on Your Geometry
A grabbed object stays behind, or shakes, when it has a rigid bodyPhysics moves dynamic bodies, and overrides the transform that your code setsMake the body kinematic while it is held. See Throwing

In AR​

ProblemCauseFix
The background is black or a color, not the real worldThe camera clears to an opaque color, or a skybox is drawnGive the camera a transparent clear color, new Color(0, 0, 0, 0), and hide the skybox layer. The XrSession script does both during AR sessions
Content placed on hit test results, planes or anchors is in the wrong place, or drifts as the user movesThese poses are in tracking space, and the rig has moved away from the scene's originAdd the content as a child of the rig, and set its local position and rotation. See Tracking Space
The background turns opaque during an AR session in React<Camera> sets the clear color from its clearColor prop each time it renders, over the transparent color that XrSession setsKeep the component from rendering during the session, or give clearColor a transparent value during AR sessions. See Your First AR Scene
Hit tests return no results on a phoneThe phone hasn't found any surfaces yetAsk the user to move the phone slowly over the floor for a few seconds. See Starting a Hit Test
A controller's or a hand's hit test source returns no resultshitTestStart() uses hit tests for transient input, which WebXR only gives for transient input sources, such as tapsTest the ray against detected planes or meshes. See Hit Tests from Screen Taps
Creating an anchor from a hit test result fails with XRFrame access outside the callback that produced it is invalidThe result belongs to an earlier frame, such as one kept for a later selectCreate the anchor in the hit test source's result handler. See Creating Anchors
Each anchor gets two objects, or the callback of create() is never calledIn engine 2.24, an anchor from a hit test result, or restored, fires add twice, and create(position, rotation) doesn't call its callback when it succeedsFollow anchors from hit test results, and restored anchors, from their callbacks, and others from add. See Creating Anchors
Light estimation is never availableIt doesn't run until it's startedCall app.xr.lightEstimation.start() in the session's start handler. See Starting Light Estimation
getDepth() always returns nullThe session's depth sensing uses the GPU, as on a Meta QuestRead the depth texture in a shader instead. See The Depth Texture
Virtual objects show in front of real objects that should hide themNothing hides them: the scene is drawn over the real worldDraw the room's meshes into the depth buffer, or use depth sensing. See Hiding Objects Behind Real Ones

Performance​

ProblemCauseFix
The view is blurry, or text is hard to readThe session renders below the device's recommended resolutionSet maxPixelRatio to window.devicePixelRatio. See Resolution
The view judders or smears as the user looks aroundFrames take longer than the headset's frame timeSee Performance, and lower the frame rate or the resolution
Fixed foveation has no effectThe graphics device uses anti-aliasing with WebGLCreate the device with antialias: false. See Fixed Foveation

See Also​

  • Testing and Debugging - Emulators, devices and remote debugging
  • Sessions - The session lifecycle, reference spaces and the camera rig
  • Troubleshooting in the User Interface section - For panels and buttons that don't respond in XR