LensStudio:AssetLibrary.Resource
ClassThe actual resources of an "LensStudio:AssetLibrary".Asset.
Index
Properties
Example
// Resource describes a downloadable file on an Asset or MusicAsset.
// Read it from asset.resources — never construct directly.
const provider = this.pluginSystem.findInterface(
IAssetLibraryProvider.interfaceId
) as import('LensStudio:AssetLibrary').IAssetLibraryProvider;
const envSetting = new EnvironmentSetting();
envSetting.environment = Environment.Production;
envSetting.space = Space.Public;
const filter = new AssetFilter();
filter.searchText = 'material';
const response = await provider.assetService.fetchAsync(
new AssetListRequest(envSetting, filter)
);
// Pick an asset compatible with the running Lens Studio version,
// then print its downloadable resources.
const lsMajor = parseInt(lsVersion.split('.')[0], 10);
if (response.ok && response.data) {
const compatible = response.data.assets.find(
a => a.maxLsVersion && a.maxLsVersion.major >= lsMajor
);
if (compatible) {
console.log('Compatible asset:', compatible.assetName,
'(max LS', compatible.maxLsVersion.major + '.' +
compatible.maxLsVersion.minor + ')');
for (const r of compatible.resources) {
console.log(' resource:', r.name, '—', r.description, '→', r.uri);
}
}
}
Properties
description
readonlydescription:string
Text description of the asset library resource.
name
readonlyname:string
Display name of the asset library resource.
uri
readonlyuri:string
URI identifying the location of the asset library resource.