Skip to main content

Building Connected Lenses

Connected Lenses for Spectacles are built in Lens Studio. Lens studio offers a number of tools for building and testing Connected Lenses in the editor and on device.

Spectacles Sync Kit

Spectacles Sync Kit is a Lens Studio package that provides the core logic, APIs, and components for building Connected Lenses on Spectacles. For more information about how to set up a project with Spectacles Sync Kit, see Spectacles Sync Kit > Getting Started.

TypeScript Status panel

The Spectacles Sync Kit package is written in TypeScript, which needs to be compiled before you can preview your Lens. Add the TypeScript Status panel to your Lens Studio layout via Windows > Utilities > TypeScript Status panel to confirm compilation.

Project Settings

In Project Settings > Platform Settings, select Spectacles. This configures the appropriate permissions for Connected Lenses on Spectacles.

Connected Lens Module

The Spectacles Sync Kit package includes a Connected Lens Module that connects your Lens to the Connected Lenses backend. The Inspector panel for the Connected Lenses Module includes a Session ID field. The Session ID is is a unique string that identifies the session. Press the Randomize Session ID button to create a new session or to reset the session for all Preview panels.

Configuring Session ID

Configuring Session ID establishes a consistent session between Spectacles and Lens Studio, enhancing the development and testing workflow for Multiplayer Lenses within Lens Studio and Spectacles. Setting the same Session ID streamlines the development workflow by eliminating the need for manual session selection in Lens Studio. When applied to both Lens Studio and Spectacles, it ensures synchronization with the same session, enabling faster iteration and the ability to test Multiplayer Lenses using a single Spectacles device.

  1. Find the Session ID on the top of Preview Panel in Lens Studio

  1. Enter this Session ID in the Spectacles App under Developer Settings > Skip Session Selection.

Configuring the same Session ID also allows users to join the same session automatically when the Lens is launched. It connects directly to the session specified in the Spectacles App, removing the need to manually select a session.

Each Spectacles device must be configured with the same Session ID in the Spectacles App.

Multiple Previews

Connected Lenses can be tested in Lens Studio using multiple Preview panels. When multiple Preview panels are open, each Preview simulates a different user in a Connected Lenses session. To add an additional Preview panel to your Lens Studio layout, select Windows > General > Preview. Configure new Preview panels for Spectacles.

Each Preview panel shows the Session ID that it is connected to. This can be used to verify that Previews are joining the same session.

To exit the session from a Preview panel, press the Refresh button at the top right of the panel. This will reset the Preview to the Start Menu.

Connected Lenses Monitor [Beta]

The Connected Lenses Monitor [Beta] is a tool that provides a real-time view of the session, including messages and data stores. It can be added from Windows > Utilities > Connected Lenses Monitor. For more information on how to use the Connected Lenses Monitor, see How to Use Connected Lenses Monitor.

Testing on Spectacles

To test your Connected Lens on Spectacles, follow these steps:

  1. Login with your Snapchat account into Lens Studio to use Direct Connection.
  2. For multiple pairs of Spectacles, pair each device to the same Snapchat account, you are using for Lens Studio login.
  3. Send the Lens to each device separately via a wired or WiFi connection. If multiple Spectacles are connected, ensure only the device to which you wish to send the Lens is awake, and put the other devices to sleep. For more details, see Direct Connection and Testing Lenses on Spectacles .

Restrictions

When building and using Connected Lenses, some APIs are restricted for privacy. For more information, see Connected Lenses > Restrictions.

Was this page helpful?
Yes
No