Skip to content

The Console ​

Everything a script logs with console.log, console.warn or console.error appears in the console, along with the engine's own notes about what the experience is doing. You can also type JavaScript into it and run it against the experience as it plays, which is the quickest way to try an idea before writing it into an action.

The console is available while editing – in the editor's preview – and while playing a published experience. The playing case is the one worth knowing about, because it is how you debug on the device the experience will actually run on.

Opening it ​

WhereHow
MacPause the experience and choose Show Console, or press ⌘⌥C at any time
iPadPause the experience and choose Show Console
iPhonePause the experience and choose Show Console – it opens as a sheet you can drag to full height
Apple Vision ProTap the console button beside the pause button on your hand, or choose Show Console from the pause menu

On Mac the console starts as a panel over the bottom of the experience, and the Open in Separate Window button moves it into a window of its own, which you can put on a second display while the experience keeps running. Put Back in the Experience returns it.

On Apple Vision Pro it is always a window, placed within reach and angled towards you. Closing the window closes the console, and the window closes with the experience.

Who sees it

The console appears for the experience's owner and their team. Nobody else sees it, and a viewer who is not signed in to an account with access never knows it exists.

Reading the log ​

Each line carries the time it was logged. Lines from your scripts and lines from the engine are shown together, so you can see a console.log next to the state change that caused it.

  • Search – the magnifier opens a field that narrows the log to matching lines.
  • Filter – choose what to show: script output, engine output, errors and warnings only, or diagnostics. The button is tinted while any filter is away from its default, so a quiet console is never a mystery.
  • Copy – puts the whole log on the clipboard, formatted as it reads, which is what to attach to a bug report.
  • Clear – empties it. A cleared console says so, so a clear that worked does not look like one that did nothing.

The console holds the most recent lines and drops the oldest as it fills, so a script that logs every frame will not grow it without limit.

Running script ​

Type into the field at the bottom and press Return to run. Shift-Return adds a line, so a multi-line snippet can be pasted or typed in one go.

  • ↑ / ↓ step back and forth through what you have run before, as long as the field holds a single line. Once it holds more, the arrows move the cursor instead.
  • Paste – the button inside the field puts the clipboard's text in without replacing what you have already typed. It is greyed when the clipboard holds no text.
  • Nothing runs on its own. Pasting fills the field; running is always a separate, deliberate press.

Script you run here is evaluated against the live experience, in the same context as its own scripts – so an object your script created is reachable by the next thing you type.

javascript
// Try it: a box a metre in front of you.
var box = await scene.createEntity(
    createBox(0.2, 0.2, 0.2).anchor(Anchor.currentPOV(0, 0, -1))
);

await works directly, with no wrapper – see Getting Started.

While paused

A paused experience completes no actions and never returns from wait(), so the input is disabled while playback is paused and the console says so. Resume, and it comes back.

What it is not ​

The console reads and writes the experience you are running, on your device. It does not reach other viewers, it is not a remote log, and nothing you type is saved into the experience. Close it and the session is gone.

For logging that your scripts control, see Events; for the API the input accepts, the whole reference applies.