Learn Spark AR Studio

Everything you need to know to create an interactive augmented reality experience.

Clear
Back

Using the Runtime Patch

You can use the Runtime patch to track the number of seconds that have passed since your effect was opened.

In this guide, you'll learn to show an object in your effect until the effect has been open for a specific amount of time. To test this out yourself, add an object like a plane to your scene.

Creating the Patches

First, create a patch to represent the Visibility property of the object. You can do this by selecting the object in the Scene tab, and clicking the arrow next to Visibility in the Inspector panel.

Next, right-click in the Patch Editor and select:

  1. A Runtime patch.
  2. An Offset patch.
  3. A Less than Patch.

The Runtime patch tracks the number of seconds that have passed since your effect started to run.

Connecting Runtime to the Offset Patch tells the effect to check how long the effect has been running and compare against the offset we define. We'll use the Less Than patch to define the offset as 3 seconds. This means that the object will only be visible when the runtime is less than 3 seconds.

Your graph should look like this:

Resetting the timer

In the example below, we've added a Screen Tap patch. It's connected to the Reset input in the Runtime patch, so the object reappears when someone taps the screen. After 3 seconds, it will disappear again.

Join the Spark AR Creator's community

Find inspiration, see examples, get support, and share your work with a network of creators.

Join Community

Frequently asked questions

Have a specific question? Maybe it's been answered.


Read FAQs
Was this document helpful?