Skip to main content
Version: 5.x
Supported on
Snapchat

Friends Sorting

This sample project is available on Lens Studio Home Page.

This sample project provides an interactive way to select roles in your Lens. The template is designed to sort through Snapchatter's friends or any customizable items. Upon launching the lens, an item or a friend from the Snapchatter's list is randomly chosen and displayed as an image (Bitmoji) accompanied by a label (or the friend's name). The Snapchatter can then assign a specific role to the chosen item or friend, associated with a particular function or characteristic. This scenario repeats until all roles are assigned.

Customizing the Sample Project

This sample project creates a unique game for users by modifying assets.

Go to the Home page in Lens Studio and find the Friends Sorting Sample Project in the Sample Project section. Click on the project card to download the project.

Next, you’ll want to name your project. To change the title, find the Tween Manager in the Scene Hierarchy panel. Expand the Camera section and navigate to the Friends Picker. Find the Title [REPLACE_ME] object. For example, type in MY SQUAD, and replace the texture in the Image component.

For easier lens customization, you can remove the Image component and add a Text component with your desired title. You can then modify the Scale, Font Size and Outline as needed. See the example below.

Remember to rename the title that will be displayed on the rear camera (Orthographic Camera) found in the Scene Hierarchy panel.

To customize the role names: Go to the Orthographic Camera and edit the Text components of objects marked [EDIT_ME].

To choose Friends or Images sorting: select the ItemsController and choose the desired Type in the ScriptComponent's inputs. There are two options - Friends and Textures. Choosing Friends you can customize fallback images in the case when the Snapchatter's friend doesn't have Bitmoji. And choosing Textures you can customize items - their Textures and Titles.

Also, if you want to adjust the Friends Sorting Order you can use the Friends Component to specify the sorting order of your friends and filters for their selection. More information about the FriendsComponent can be found here.

You can modify the positioning of roles, as well as remove or add new ones. To add new roles, follow these steps:

  1. Create a material and texture for the new role.

  2. Create an object for the new role and set its position.

  3. Replace the material and texture for the Image component of the Item Image object.

  4. Change the title for the new role.

  5. Add the new role to the MainLogic script.

To decrease the number of roles, remember to remove the corresponding roles from the input data of the MainLogic script.

If you're changing the positioning of roles, remember to adjust the positioning of the Tap hint.

Previewing Your Lens

You’re now ready to preview your Lens experience. To preview your Lens in Snapchat, follow the Pairing to Snapchat guide.

Was this page helpful?
Yes
No