Skip to main content
Version: 5.x

Asset Packages Introduction

In Lens Studio, Asset Packages refers to a set of resources that can be managed and versioned from the library. They will have the extension .lspkg.

Not all .lspkg files are considered an Asset Package. You must explicitely go through the Create Package flow in order to create a package.

Creating a Package

In order to create an Asset Package, right click on whichever assets or folder you'd like to package and select, Create Package.

Export a Package

To export a package, right click on the root of the package and select, Export Package.

You have an option to export as Editable or Locked.

Exporting will bundle all referenced resources inside the asset. In case of exporting as Editable, whoever you share the file with will be able to see and edit the package. You can right-click and select Unpack for Editing in the drop down menu to unpack all assets stored in the bundle.

Asset Package Inspector

The Asset Package Inspector is present when you click on the root of the package. Here you’ll be able to change the icon, description, and version.

Asset Library

The Asset Library contains many Asset Packages. When you install them to your project, they will get imported into your Asset Browser and will be installed into the path set in your Installed Content Preferences.

For packages that have been installed to your library, you can import them from the Add New Asset menu. They will show under the Installed Packages section.

Accessing Items In Packages via Scripting

Scripts can access other assets within packages, using similar mechanisms described in Script Modules.

To access anything within your package, you must provide the full name of the package with the extension .lspkg.

For example, my Package.lspkg contains:

  • myCustomComponent.lsc
  • myJsModule.js
  • myPng.png

In order to access these items, in my JS script asset, I can do the following:

myScript.js
const myCC = requireType('myPackage.lspkg/myCustomComponent.lsc');
const myModule = require('myPackage.lspkg/myJsModule.js');
const myAsset = requireAsset('myPackage.lspkg/myPng.png');
Was this page helpful?
Yes
No

AI-Powered Search