Skip to main content

LensStudio:GuiService

Module

Module providing GUI service plugin infrastructure for Lens Studio.

Example

// The LensStudio:GuiService module provides the GuiService base class
// for plugins that manage GUI panels in the editor.
//
// GuiService extends Editor.IPlugin with start()/stop() lifecycle.
// Use it instead of CoreService when your plugin needs GUI awareness.
//
// Lifecycle: constructor -> start() -> stop()

export class GuiServiceExampleService extends GuiService {
connections: any[];
static descriptor() {
const d = new Descriptor();
d.id = 'com.docs.GuiServiceExample';
d.name = 'GuiService Overview';
d.description = 'Demonstrates a minimal GuiService';
d.dependencies = [Editor.Model.IModel];
return d;
}
constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
super(pluginSystem, descriptor);
this.connections = [];
}
start(): void {
const model = this.pluginSystem.findInterface(Editor.Model.IModel) as unknown as Editor.Model.IModel;
console.log('GuiService started');
console.log(`Project has ${model.project.assetManager.assets.length} asset(s)`);
}
stop(): void {
this.connections.forEach((c: any) => c?.disconnect());
this.connections = [];
}
}

Classes

ClassDescription
DescriptorDescriptor object for configuring a GuiService plugin instance.
GuiServicePlugin class managing GUI service registration and initialization within the editor plugin system.