Editor Scripting API

    Script Assets are text files that contain the code you write for your Lens. Scripts are written in Javascript or TypeScript.

    ///@input string stringToPrint = "Print this on Tap"
    //@input int testIntProperty = 7
    //@input int[] testIntArray = {1, 2, 3}

    scriptAsset.stringToPrint = "New String";
    scriptAsset.testIntProperty = 9;
    scriptAsset.testIntArray = [4,5,6];

    // set icon
    const buffer = Editor.FileSystem.readTextAll(path to svg file)
    const newIcon = Editor.Icon.setIconFromSVGData(buffer)
    scriptAsset.icon = newIcon;
    // getIcon
    const icon = scriptAsset.icon

    // set description
    scriptAsset.description = "helloWorld"
    // get description
    const desc = scriptAsset.description

    // hide input
    scriptAsset.setScriptInputHidden("myInputName", true);

    // unhide input
    scriptAsset.setScriptInputHidden("myInputName", true);

    // check visibility of input
    scriptAsset.isScriptInputHidden("myInputName");

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    cacheFile: Path
    componentId: Uuid

    Id associated with the script asset.

    description: string

    Description associated with the script asset

    exportId: Uuid

    Export id associated with the script asset.

    icon: Icon

    Icon associated with the script asset.

    id: Uuid

    The unique id of the entity.

    name: string

    The name of the asset.

    type: string

    The entity's type.

    version: Version

    Version associated with the script asset.

    Methods

    • Beta

      Parameters

      • type: string

      Returns boolean

    • Beta

      Returns true if the script inpput is hidden from the scene.

      Parameters

      • inputName: string

      Returns boolean

    • Beta

      Swap this entity for another one based on a JSON of the current entity id and the target entity id.

      Parameters

      • referenceMapping: object

      Returns void

    • Beta

      Used when you'd like to hide inputs from users in the scene.

      Parameters

      • inputName: string
      • hidden: boolean

      Returns void

    MMNEPVFCICPMFPCPTTAAATR