Using the Script Editor
To open the Script Editor, double click a script in the
To learn about how scripts work in Lens Studio and adding interactivity to Lenses, check out the Scripting Overview guide.
As you write your script, the Script Editor will provide you with suggestions for code that you might be trying to write, including suggestions for Lens Studio specific code.
For example, if you wanted to access an object that is in your scene within your script, as you declare the input, the Script Editor will suggest the type of things you can access.
When you complete the input declaration, Lens Studio will process what you write and summarize your inputs in the
This tight coupling between the Script Editor and other Lens Studio panels allows you to quickly build interactivity into your Lenses.
The Script Editor also understands context. For example, when you type
myObject will show up in the list of suggestions since it was declared earlier.
Additionally, after typing
myObject, the Script Editor will show you what properties that object has since it understands its type.
You can go through the list of suggestions to bring up the documentation for that specific suggestion by using the up and down arrow keys.
Once you’ve added the script into your Lens, the Script Editor will report any errors it may find by highlighting the line number of the line with the error in red. You can hover over the line number to get additional information about the error.
You can also open multiple scripts in the Script Editor at the same time. When you have multiple scripts open in the Script editor, you will see a tab for each file. You can navigate to a tab by double-clicking the file in the Resources panel, or by selecting the tab itself.
The Script Editor will mark unsaved file with a dot in the top right corner of the file’s tab. With the Script Editor panel in focus (e.g. while typing),
CMD + S on Mac or
CTRL + S on Windows will save the script, rather than the project itself.
To learn more about writing scripts or find example scripts, check out the Scripting Example page.
Setting your Default Editor
You can open the Lens Studio preferences to select how your scripts open by default. In your Lens Studio menu, press
Lens Studio > Preferences. Then, in the pop-up window, check the box next to
Open Scripts in External Editor.
Still Looking for help?Visit Support