Skip to main content

requireAsset

Function

Load an asset like a Texture, Material, or MLAsset directly from script.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

requireAsset(name): Asset

Load an asset like a Texture, Material, or MLAsset directly from script.

You can use the modules name or path. Both “by name” or “by path” will be relative to the script which is calling require, but by name will check the same folder as the script, then the parent folder, and so on. In addition, any require can be relative to your library folder. Take a look at the Scripting guide to learn more.

Parameters

ParameterType
namestring

Returns

Asset