Lens Studio AR UI workshop for Snap Spectacles. Learn how to build an interactive UI step guide with a color picker that modifies objects using environment-based inputs. Created for ACAD207 (USC Snap Spectacles Class).
An interactive experience where you will add a shape to the scene, change its size, and change the color of the object using your environment.
- Allows you to use UI for user input to customize your experience
- First we need add the newest version of the Spectacles Interaction Kit examples to the project
- Click on Asset Library, search up ‘SpectaclesInteractionKit’, and then the three dots, and then 0.16.4
NOTE: You must add the newest version to the project! Otherwise some of the assets won’t show up and you will get missing materials!
- Now let’s make a Scene object called ShapeCreator that will hold our 3 panels
- To do this, right click in the scene, click Create SceneObject
- then right click on it, rename → rename it to ‘ShapeCreator’
- Now let’s make the following 3 Panels by modifying the UI from the SIK examples.
- Find the ‘Toggle Group Layout Panel’, in the UI Starter
- right click to copy it
TIP: You will need to
- Modify the text values
- Move the next button to the bottom right corner
- (If you want) Play around with the Toggle Group Layout’s Frame component ‘Inner Size Value’ numbers to make it look better visually!
- Feel free to adjust the UI how you’d like it
TIP: Rename the buttons to make it easier to assign them to scripts later on!

- Before we make the second panel, toggle the visibility (by unchecking the checkbox) of the ‘SpawnShapePanel’ so it’s not blocking our view for the next panel
- Find the ‘Sliders Layout’ object in the UI Starter, and right click to copy it
TIP: You will need to
- Modify the text values
- Delete two of the sliders, so that there is only one
- Delete the ‘A, B, C’ text next to the sliders
- Position the next button properly
- (If you want) Play around with the Toggle Group Layout’s Frame component ‘Inner Size Value’ numbers to make it look better visually!
- (If you want) Make the slider bigger to make it look better visually!
- Finally, let’s make the last panel! Remember to toggle the visibility of ‘ChangeSizePanel’ so that you can see only the final panel in preview easily
- This one is a simple panel with text, just duplicate the ‘Toggle Group Layout’ from the ‘SpawnShapePanel’ or the ‘ChangeSizePanel’ and paste it into ‘ChangeColorPanel’
- Modify the panel so that it just has three text fields positioned over the panel below
- Now let’s add our 3 meshes to the scene, the cylinder, the sphere and the cube!
- In the Asset Browser click on the plus (+) sign → then search for Box
- In order to have our color changing functionality work, we need to add a specific material to it
- Click on the BoxMesh in the scene
- In the inspector, click on the Material 1 slot
- Search for ShapeColorMaterial, click on it, and click OK
Note: Before we start to add functionality, make sure all of your panels are visible
Your project should now look like the picture below, with overlapping panels and shapes above the panels. You won’t see the color changing until we add the functionality.
Now let’s add scripts to our objects so that it functions properly! All the scripts are provided in this project, so you won’t need to add any, but you will need to add them to the objects properly. If you are interested in the script functionality, I have commented on all of them, so feel free to read through and see what they do!
Note: Your preview will pause when you add scripts that need to have objects assigned to them. Make sure you follow the instructions closely to assign all the parameters otherwise the project wont compile
The color changing functionality is based on some functionality from this Spec Developers blog, read about it here if you’d like! https://armandsumo.com/posts/eyedropper-for-spectacles-ar-glasses/
- Click on the ‘ShapeCreator’ object
- In the Inspector, click the ‘Add Component’ button and add ColorPickerController
- For Sample Color Indicator slot, click on it, search for ‘Sample Color Indicator’, select it,and click OK
- For Spawn Shape, search up SpawnShape and add that
- Next let’s add functionality for the ‘ChangeSizePanel’ so click on it next
- In the Inspector, add the ‘SliderScaleController’ component
- Drag your slider inside of the ‘ChangeSizePanel’ to the slider slot
- It should look like this
- Now Select the ‘SpawnShapePanel’
- In the Inspector add the ‘SpawnShape’ script component
- In the ‘Cylinder Mesh’ slot, search for Cylinder, and select its render mesh visual. Do the same for the other meshes
Now on the same SpawnShapePanel, click Add Component and add ‘PanelNavigator’
- Drag the panels we made into their respective inputs
- In ‘Next Button’, drag the Next Button from ‘SpawnShapePanel’
- In ‘Next Button 2’, drag the Next Button from ‘ChangeSizePanel’
- For Color Picker Controller, search for ColorPickerController and add it
- The PanelNavigator component should look like this
Now refresh your Preview, and your project should compile! You can test the first two panels in editor, but to see the color changing effect you have to launch to your Spectacles (See Step 5)
Note: If your project Isn’t compiling:
- Review the images of the component, and make sure your scripts are all assigned just like the images
- Read the logger, it will tell you what component isn’t “awake” yet, meaning the parameter needs to be assigned
- Make sure you have assigned ALL of the scripts in this part
- Refresh preview
- Your lens should now work! Please note the color changing only works in the Spectacles, not in the preview in Lens Studio
- Test it out by connecting your Spectacles and clicking the Preview lens button
- Watch the demo video to see how to do the pinching mechanic required for changing color
- Record a video by clicking the button on top of the left side of your glasses. Click it again once you are done recording.
Note: Keep your Spectacles turned on while it’s downloading, mine had some issues where the video failed to download and I had to rerecord…
What to Submit:
- Submit the video recording to Brightspace of your working lens in the Spectacles
- 3D Challenge: Change the cylinder shape to a Star, and the sphere to a heart
- Make the meshes in Blender and then import them. Make sure to add the correct ShapeColorMaterial to them!
- Scripting Challenge: Add functionality to pinch to select a color, instead of the color changing by hover only
- UI + Scripting Challenge: Add a back button for the panels and make them functional
- Hint: Duplicate the Next button and rotate it. And then modify the PanelNavigator script
- UI + Scripting Challenge: Add a slider to rotate the object and make it functional!
- UI Challenge: The ‘X’ buttons are not necessary for this project, delete them to make the UI look cleaner!
- Right now you can make the shape extremely big. Modify the boundary in editor using SliderScaleController
- Make the shape interactable, so you can move it around
- Hint: the SIK Example Project has a ‘Simple Interaction’ example you can look through. See what components are on the object!


























