Skip to content

Preview and Test ​

Preview runs your project inside the editor window, on the same @relu-interactives/spatial-ecs engine your published game uses. There's no separate window to open and nothing to save first: Preview includes your unsaved changes.

A 3D game running in the Preview tab

Edit and Preview ​

The middle of the navbar has two tabs:

  • Edit is the scene you build in.
  • Preview runs your experience in place of the viewport.

Click Preview to start. The first time, the editor installs the project's packages and starts a local server, so you'll see "Starting preview…" or an install bar for a moment. Click Edit to go back to the scene. The preview server keeps running in the background, so switching back to Preview is quick.

Keys like WASD and Space go to the game as soon as it loads, so you can play straight away.

Needs Node.js

Preview, Publish and the profiler need Node.js 20 or newer. If it's missing, the Preview tab shows an install card with Download Node.js and Restart Relu Spatial. See Installation.

The preview controls ​

A row of controls sits along the top of the running game. Which ones you see depends on the project type.

ControlWhat it does
Device pickerRun a 3D game as a phone, tablet or desktop (below).
StatsShow FPS, frame times and memory (below).
Restart button (circular arrow)Rebuild and reload the preview. Its tooltip says Restart preview (or Update preview for XR projects).
Open in browser (arrow out of a box)Open the same preview in your system browser, for its developer tools or other window sizes.

Updating the preview after an edit ​

Edits you make in the Outliner and inspector while previewing don't reach the running game by themselves, because reloading under you would reset whatever you were testing. Instead, a Scene changed · Update preview pill appears. Click it (or the restart button) when you're ready to see your changes.

Phone, tablet and desktop ​

In 3D projects, the first control is a device picker ("Preview on a phone, tablet or desktop"):

  • Desktop fills the pane and uses the mouse.
  • Phone portrait (390 × 844), Phone landscape (844 × 390) and Tablet (820 × 1180) run the game at that screen size, scaled down to fit the pane.

The device picker open

Next to the picker, the rotate button turns a phone or tablet, and a label shows the device, its size and the scale (for example "Phone · 390 × 844 · 83%").

A phone or tablet is a real touch screen to your game. Your mouse becomes a finger: a click is a tap and a drag is a swipe. The game also sees a touch device when it checks the screen, so touch controls, on-screen prompts and touch-only CSS switch on just as they would on a real phone. Switching device or rotating never reloads the game.

A game previewed as a phone

The editor remembers your pick. To test on a real phone, use the QR code instead. Games that read input are covered in Game input and Quality and devices.

Stats ​

Click Stats to open a panel at the top right of the running game. It shows:

  • FPS, with a 30-second graph (green at 55 and above, amber from 30, red below).
  • Frame (average time between frames) and Worst frame (the longest in the last half second, where a hitch shows).
  • Update: CPU time in the game's update each frame.
  • Draw calls and Triangles.
  • Geometries, Textures and Shaders held on the GPU.
  • JS memory, Entities and Resolution (canvas size and pixel ratio).

Hover a label for a short explanation. The panel stays open across previews until you click Stats again.

The Stats panel

If the panel says "No stats from this game yet", the project was made before the stats were added: accept the project update (see Projects), then restart the preview.

For a full recording of a session, with every lag spike explained, use the Profiler.

Errors from your game ​

When the running game logs errors to its console, a bar appears above the message box in the Agent tab: "The game logged 3 console errors". It collects errors from whoever was playing, you or the agent.

  • Attach to message adds the errors to your next message as a chip, so you can ask the agent to fix them.
  • The × dismisses them. They stay dismissed; only new errors bring the bar back.

Errors from a game running on a headset are marked as such (see Testing on a headset).

When the agent is playtesting ​

The agent can open Preview and play your game itself. While it does, the navbar shows an AI is playtesting badge. Click Take over to get the controls back. If the agent picked a device size for its test, taking over returns you to your own pick.

Test on a phone or another device ​

While the preview is running, a QR button appears next to the Edit | Preview tabs ("Open on another device"). Click it to see Test on your device: a QR code and the address, with Copy.

  • Same WiFi network: scan the code with a phone on the same network as your computer. The first time, accept the one-time "not private" certificate warning on the device. Your computer signs its own test certificate.
  • This computer only: no local network was found, so the link only opens on this computer.

This is the way to try camera tracking with a real phone camera, or touch on real hardware.

Image tracking: Desk test ​

An image-tracking project's preview opens on its targets page. Click Desk test to test on a fake desk instead, with no phone or printed image.

The Desk test in an image-tracking project

With the Desk test on, the toolbar gains:

  • On the desk: pick which of your image targets is lying on the desk. If your targets make up a book, choose Book to lay out every page, and Back to one print to return.
  • A view menu with named camera views: Straight on, At an angle, Low angle, Close up, Far away, Moving around, Dim room, Hand in the way and On a stand (plus Whole book for a book).
  • Free camera: move the camera yourself (orbit, zoom, pan and fly). A readout shows whether the target is Tracking or Lost, its distance, angle, how much is in view and how long it took to find.
  • Find target: glide back to a good view of the target.
  • A hand-pose menu (No hand, Open palm, Fist, Pointing, Pinch, Thumbs up, Peace) to test hand gestures.

Click Desk test again to go back to the targets page. See Image tracking for setting up targets.

Face tracking: what the preview sees ​

Face-tracking projects have a source menu in the toolbar:

SourceWhat it is
Your faceYour camera, the way a visitor's phone does.
Video 1, Video 2Preset videos, with no camera needed.
Test headA rendered head you can turn, for checking fit.

Face-tracking preview with the test head

With Test head, more menus appear:

  • A view menu: Front, Three-quarter, Side, Turning, Nodding, Shaking, Tilting and Talking.
  • An expression menu: Neutral, Smile, Open mouth, Blink, Wink, left of picture, Wink, right of picture and Raise brows.
  • The same hand-pose menu as the Desk test.

A small readout shows whether a face and hands are found and which gesture each one makes. If the editor isn't allowed to use your camera, the preview says so with Open System Settings and Use a video.

See Face tracking, Face tracking scripting and Face gestures.

XR projects: test on a headset ​

VR and mixed-reality projects don't run in the pane. Their Preview sends the game to your headset over your local network and shows what the headset sees. That has its own page: Testing on a headset.

When the preview won't start ​

If the preview fails, the pane shows Preview couldn't start with the reason, Try again and Back to editor.

SymptomLikely cause
"Version 20 or newer" cardNode.js is missing or too old. Install it, then Restart Relu Spatial.
"Port 5173 is already in use"Another copy of the editor, or a profile running on a headset, holds the preview's port. Close it or stop the profile.
The game hasn't changed after an editClick Scene changed · Update preview, or the restart button.
Black screenNo camera in the scene, or the camera's clear colour matches the fog.
Scripts don't runCheck the errors bar in the Agent tab for the game's console errors, and attach them to a message for the agent.

Next ​