The Console can be used to test and debug your projects in Spark AR Studio in two ways:
To show or hide the Console:
The Console will appear below the Viewport.
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.
The Show All dropdown menu can be used to filter console messages:
The Search box can be used to filter the console to only show messages that include the search terms used.
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.