RemoteReferenceAsset
ClassProvides a reference to a remote asset (i.e. assets outside of the Lens size limit) that can be downloaded at runtime using script.
- Available on all platforms
Since Lens Scripting v182
Index
Properties
Methods
Example
//@input Asset.RemoteReferenceAsset myRemoteReferenceAsset
//@input Component.AudioComponent myAudioComponent
function onFailed() {
print("Asset wasn't downloaded from the reference " + script.myRemoteReferenceAsset.name);
}
function previewDownloadedAsset(asset) {
if (asset.isOfType(AudioTrackAsset.getTypeName())) {
script.myAudioComponent.audioTrack = asset;
script.myAudioComponent.play(1);
} else {
print("Warning, asset has type " + asset.getTypeName() + ", please set Audio Component input to display");
}
}
script.myRemoteReferenceAsset.downloadAsset(previewDownloadedAsset, onFailed);
Extends
Properties
name
name:
string
The name of the Asset in Lens Studio.
Default Value
""
Inherited from
uniqueIdentifier
readonlyuniqueIdentifier:string
Since
Lens Scripting Version 176
Inherited from
Methods
downloadAsset()
downloadAsset(
onDownloaded,onFailed):void
Request to download the Remote Reference Asset.
Parameters
| Parameter | Type |
|---|---|
onDownloaded | (asset) => void |
onFailed | () => void |
Returns
void
Since
Lens Scripting Version 182
getTypeName()
staticgetTypeName():TypeName<RemoteReferenceAsset>
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<RemoteReferenceAsset>
Since
Lens Scripting Version 182
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean