Skip to main content

Scripting

Writing scripts and wiring them into the scene: script components, decorators, script assets, require, and the script globals.

Commonly used

Guides

All APIs in this topic

Add components to a scene object and reference assets and other modules with a script input.

Components, assets, and modules

APIDescription
EditorInteractionProfileDeclares how stock Scene Editor Move / Rotate / Scale manipulators may interact with a SceneObject.
NativeLibraryAsset SPECSNativeLibraryAsset loads a native shared library (e.g. .so, .dylib, .dll) and exposes its exports to JavaScript.
ScriptAssetRepresents a JavaScript or TypeScript script that can be used to add logic in your Lens.
ScriptComponentUsed to bind custom JavaScript or TypeScript code to specific Lens events for dynamic interactivity.

Objects and data

APIDescription
BaseScriptComponent TypeScript only
Decorators TypeScript onlyThe Decorators typings for TypeScript Lens scripts.
global
isNullReturns true if the passed in object is null or destroyed.
requireLoad a JavaScript module.
requireAssetLoad an asset like a Texture, Material, or MLAsset directly from script.
requireTypeLoad a script by name or path in order to use that type to create or get a component at runtime.
script
UIControl TypeScript only