Overview
Plugins are add-ons that can be installed in Lens Studio 5.0 to extend the app’s capabilities and enhance developer workflows. Plugins empower developers outside of the Lens Studio engineering team to build Studio functionality to suit their needs.
Plugins are written in JavaScript (ES10) using the newly added Editor API, which exposes data of the editor and the opened project (for example, scene and asset information) to plugin developers. The Editor API is similar to the Lens API, but runs in Editor rather than in a Lens at runtime.
You can use the Yeoman Generator to accelerate your plugin development process. The generator will generate the necessary files as well as boilerplate code to help you get started.
Some use cases that the Editor API is capable of doing:
- Create and edit scene objects and components
- Read and write to the file system
- Create and manage project assets
- Create and configure script components (including custom components)
- Listen for context menu interactions
- And more…
Plugin Types
Every plugin type derives from the Editor.IPlugin base interface—the API reference page lists the full class hierarchy and is the canonical place to discover every plugin base class that is available.
Your plugin can be one of the following types by having the class extend the corresponding base class:
-
Core Service and GUI Service: Both are long-lived service plugins with their own lifecycle (
start/stop) that can hold internal state. The key difference is when they load. A core service is always loaded—including in headless/CLI mode—and starts running when Lens Studio launches, continuing until the app closes or the plugin is disabled in the Plugins Manager. A GUI service is loaded only when Lens Studio runs with its GUI (not in CLI mode), and starts after core services. The base classes areCoreService(API reference) andGuiService(API reference). -
Presets: A preset is a "smart" asset, component, or scene object configured to work out of the box and handle its dependencies. When loaded or imported, presets become available in the "+" menu in the Asset Browser, Inspector, or Scene Hierarchy. Presets are created on demand when a Studio user adds one to a project from a "+" menu. The base class is
Preset(API reference). -
Panel and Dialog: These two types of plugins are classified as UI plugins, a category that provides complete control over dedicated user interface components. Upon activation, the plugin renders its own panel or dialog, which it manages autonomously. Customize the user interface with the UI components provided by the
LensStudio:Uimodule, such as buttons, scrollable containers, text labels, and numerous other interactive elements. The base classes arePanelPlugin(API reference) andDialogPlugin(API reference). -
Editor Plugin: Also a UI plugin—it extends
PanelPluginto provide a dedicated editor for specific entity or asset types. The base class isEditorPlugin(LensStudio:EditorPlugin, API reference). -
Project Settings Plugin: Adds a custom section to the Project Settings dialog so your plugin can expose project-scoped configuration. The base class is
ProjectSettingsPlugin(LensStudio:ProjectSettingsPlugin, API reference). -
Chat Tool: Exposes a tool to the in-Studio AI chat assistant. See Chat Tool Plugins. The base class is
ChatTool(LensStudio:ChatTool, API reference). -
Asset Instantiator: Defines how a given asset type is instantiated into a project—resolving its dependencies and creating the resulting assets or scene objects when the asset is added (for example, dragged into the scene) or previewed. The base class is
AssetInstantiator(LensStudio:AssetInstantiator, API reference). -
Entity Generator: Generates scene entities (objects/components) on demand from a
+menu entry. The base class isEntityGenerator(LensStudio:EntityGenerator, API reference). -
URI Handler: Registers a handler for a custom URI scheme so external links open and route into your plugin. The base class is
UriHandlerPlugin(LensStudio:UriHandlerPlugin, API reference).
Examples
Here are some working examples of different plugin types, for you to explore and learn from:
Core Services
- GitStatusChecker: A core service that periodically checks the git status of the current project.
- ObjectMenuItem: Adds a new action to the Object panel's asset context menu.
- TCPServer: Creates a TCP server that listens for incoming connections.
Presets
- ComponentPreset: Adds a new preset to the Add New Component list.
- ObjectMenuPreset and AssetMenuPreset: Add new items to the Object and Asset context menus, respectively.
UI Plugins
- PanelWidgets: Demonstrates the implementation of a panel plugin, showcasing most types of UI widgets.
About the JS environment
The environment uses a Node.js-like structure, enabling ECMAScript (ES10) imports and exports. However, it's not a full Node.js or standard browser environment. Essentially, we're working with JavaScript (ES10) here, incorporating some Node.js-style features like import.meta.url and import.meta.resolve. These are part of our convention-based approach and do not represent a complete Node.js implementation. You're free to use other JavaScript scripts as long as they don’t rely on specific features exclusive to browser or Node.js environments to function.
We're always improving our plugin system and adding features. Let us know what you need to make it even better.
Contributing a Plugin
As with other content in Lens Studio, we’ll be happy to help you share your awesome plugins with the creator community once plugins are available to all. Take a look at the Asset Library publishing guide to learn more.