Development Workflow
Since the Connected Lenses experience works best when more than one device is connected, take a look at the following tips on how to test your experience.
Testing Methods
You can test on your Lens in both Lens Studio and on device. Which method is most helpful will depend on what you're working on:
- Lens Studio: Allows you to easily get debug information and iterate, but can not connect to a backend to test connection flow
- On Device: You can push to multiple devices simultaneously and test data being sent to each other. However, debugging experience is not as robust.
Testing on device
If you have multiple devices handy, you can pair them all to Lens Studio and push your Lenses to each of them with a single button press. This is handy to test out your experience in the real world.
To do this, first pair a device to Lens Studio as you would normally by pressing the Preview in Snapchat
button. Then scan the Snapcode with your first device.
With your first device paired, we can pair the next device by pressing the down arrow to the right of the Send to Snapchat
button, then press Pair new Snapchat Account
. Then on your next device, scan this Snapcode to pair the second device.
Now, when you press Send to Snapchat
, both devices should receive your Lens update!
Once all your phones have the Lens, you will be able to test your Lens as if your Lens was already published.
For the co-located case you can test the experience by generating a map with one device and sharing your session via Snapcode; the other paired devices will be able to scan that Snapcode from the device’s screen and be able to join the same session.
For the remote case, when the Lens is published you will be sharing sessions via invitation using Chat, but when paired with Lens Studio you will connect directly to the session without being able to invite anyone via the invitation flow.
Clearing Session Data
When you want to clear the session data that your devices are connected to, you can use the Clear Test Session
button from the Inspector
window of Connected Lens Module
.
You can print out your logs on a Text component to display your logs on your mobile device.
Testing in Lens Studio
You can use the Preview panel to test out the parts of your experience which do not need a connection to the backend within Lens Studio.
You can use both a video preview, as well as the Interactive Preview. However, Lens Studio itself can not participate in a real session with Snapchat.
Using Video Preview
When using video preview, you can use the videos under the Co-located section to test your Lenses. These videos are longer and have World Tracking data embedded in them. This will allow you to simulate how a user might “scan” their area to generate a co-located map which is used to synchronize the world coordinates of participants. Additionally, it will allow you to test how World Tracking, which is used to localize the player’s experience, will work with your Lens.
Make sure you are in the Rear camera, and are looking at Video previews
Using Interactive Preview
In addition to video previews, you can use Interactive Preview to simulate moving around your Lens experience. For example, you can test what happens when a user gets closer to an object in your Lens.
To activate the Interactive Preview mode, press the Interactive Preview button at the top left of the Preview panel
To move around press WASD
on your keyboard. Press CTRL
to move down, and SPACE
to move up.
Clearing Co-Located map
To streamline the development process, Lens Studio will cache the co-located map generated by scanning the surrounding in the video so that you don’t have to do it every time you reset your Lens. However, you will want to clear this cache at times to double check what a real user experience might look like.
Working with Lens Studio is a great way to get logs and information as you are building your experience!