Testing and Debugging

The Console can be used to test and debug your projects in Spark AR Studio in two ways:

  • Console logging.
  • Signal watching.

Breakpoints are not currently supported within scripts.

Showing and hiding the Console

To show or hide the Console:

  1. Click View in the menu bar.
  2. Select Show/Hide Console from the menu.


The Console will appear below the Viewport.

Console Logging

You can use the Console in Spark AR Studio to log messages and variables from scripts you've added to your project.

Messages and variable values can be logged from within a script with the log() method of the Diagnostics Module.

// Load in the Diagnostics module
const Diagnostics = require('Diagnostics');

// Log a string message  
Diagnostics.log('A console message logged from the script');

let myVariable = 5;

// Log a variable's value  
Diagnostics.log(myVariable);


Once you're ready to test your effect on a device, you can use the Spark AR Player app.

If you connect your device via USB cable and select Send To Connected Device from the Send To Device menu, you will be able to select your device from the device dropdown within the Console to see messages logged from the device.



Log statements left in your scripts may have a negative effect on performance so remove all Diagnostics.log() calls before shipping your final effect.


Filtering the Console

The Show All dropdown menu can be used to filter console messages:

  • Show All - Shows all messages.
  • Errors - Shows only error messages.
  • Warnings - Shows only warning messages.
  • Logs - Shows only messages logged from scripts.


The Search box can be used to filter the console to only show messages that include the search terms used.



Signal watching

Signal values can be shown in the Console from within a script with the watch() method of the Diagnostics Module.

// Load in the required modules
const Diagnostics = require('Diagnostics');
const FaceTracking = require('FaceTracking');

// Add the mouth openness signal to the watch view
Diagnostics.watch("Mouth Openness - ", FaceTracking.face(0).mouth.openness);

The watch view appears in the top right of the console.