There are two ways to test and debug your projects in Spark AR Studio:
You can use the Console in Spark AR Studio to log messages and the values of variables from scripts you've added to your project.
To show or hide the Console:
The Console will appear below the Viewport.
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);
Log statements left in your scripts may have a negative effect on performance so remove all
Diagnostics.log() calls before shipping your final effect.
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.
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.