Skip to main content

The process to create augmented reality effects often involves trial and error. As you experiment and test new features for your effect, you’re likely to encounter bugs, incorrectly connected patches and even crashes.

This video therefore explains:

  • Approaches to help you avoid crashes.

  • How to use JavaScript to test and debug scene interactions and process signals.

  • How the Spark AR console can help you test and debug scene interactions and process signals.

Learn more about testing and debugging logic

At some point during the AR effects design process, a creator can expect to get stuck. The process requires experimentation, so bugs, errors, incorrectly connected patches and even some project crashes are almost inevitable along the way.

As you develop a better understanding of debugging and how to run tests and read logs, you may find there are numerous ways to avoid such interruptions. Fortunately, Spark AR has tools that offer creators insight into the bugs that may occur in their patch logic as well as in their scripting.

Output is generally organized under two broad categories: the assessment of architecture failures and the assessment of immediate bugs. The first refers to broad errors within Patch Editor or a new Spark AR script that can render your scene unusable.

In Spark AR, shader code forms the structure that the patch editor reflects. The JavaScript/TypeScript Scripting API outputs to the console log where the user can find the information regarding possible errors in their code or problems with their scene objects. The console ultimately helps users understand how to bypass errors that may not be immediately noticeable.

Creators must be able to understand the acute errors that can arise during effect development. At the same time, they must also be able to note the larger patterns of flawed logic, improper scene organization and problems with accessing functions necessary for the execution of the AR effect. If, for example, a creator notices that their AR project stops working entirely, they can refer to the Spark AR console to locate bugs and errors.

Working in the console

In the console, the red text displays a more critical error along with additional information that can lead you to the section of your code where you can uncover a possible mistake. In contrast, yellow text in the console often describes non-critical errors or warnings that indicate where a section of code may need updating so that it doesn’t fail as Spark AR evolves.

To learn more, you can refer to the testing and debugging tutorial on Spark AR Learn.

Key takeaways

Testing and debugging is a process that makes it easier for creators to build solid systems in their scripting. Integrate testing and debugging into your development to better identify patterns that are likely to negatively impact your ability to efficiently collaborate with a team in the future.