Asset
ClassBase class for all assets used in the engine.
- Available on all platforms
Base class for all assets used in the engine. Assets can be unique to Lens Studio, such as VFXAsset, or a representation of an imported asset, such as Texture for jpg, png, and other image formats. In most cases, assets are added to the scene via a Component.
Index
Properties
Methods
Remarks
For example, you might import an .jpg file into your project to be used in the Lens by dragging your file into the Asset Browser panel, which will create a Texture asset. Then, in the Scene Hierarchy panel, you can add a SceneObject containing the Image component (Scene Hierarchy panel > + > Image), and set the Texture field of the Image component to the newly imported asset in the Inspector panel.
Example
// @input Asset.Texture myTexture
const currentObj = script.sceneObject;
const imageComponent = currentObj.createComponent(Image.getTypeName());
const imageMaterial = imageComponent.mainPass;
imageMaterial.baseTex = script.myTexture;
@component
export class AssetExample extends BaseScriptComponent {
@input()
myTexture: Texture;
onAwake() {
const currentObj = this.sceneObject
const imageComponent = currentObj.createComponent(Image.getTypeName());
const imageMaterial = imageComponent.mainPass;
imageMaterial.baseTex = this.myTexture;
}
}
Extends
Extended by
AnimationTrackAudioTrackAssetVectorCompositeWorldUnderstandingModuleTextureTextInputModuleSupabaseProjectSupabaseModuleScanModuleRenderMeshRawLocationModuleProcessedLocationModuleNativeLibraryAssetMaterialInternetModuleGaussianSplattingAssetFaceTrackingModuleExternalMusicModuleDeviceTrackingModuleCustomAssetCommerceKitModuleCameraRollModuleAsrModuleAnimationAssetRayTracingSettingsBinAssetLocalizationsAssetGltfAssetLeaderboardModuleRemoteServiceModuleRemoteMediaModuleRemoteReferenceAssetScriptAssetTrackingScopeVFXAssetMarkerAssetFontFontFamilyFontCollectionLocationAssetLocationCloudStorageModuleAnchorModuleAnchorLocationModuleMotionControllerModuleGameControllerModuleShoppingModuleGestureModuleSpecsInteractionModuleSpectaclesMobileKitModuleDeepLinkModuleMatterCollisionMeshConnectedLensModuleCloudStorageModuleVoiceMLModuleTextToSpeechModuleDialogModuleMapModuleBitmojiModuleCameraModuleObject3DAssetDepthModuleObjectPrefabWorldQueryModuleAudioEffectAssetHairDataAssetUserActivityModuleBluetoothCentralModuleFilterWorldSettingsAsset
Properties
name
name:
string
The name of the Asset in Lens Studio.
Default Value
""
uniqueIdentifier
readonlyuniqueIdentifier:string
Since
Lens Scripting Version 176
Inherited from
SerializableWithUID.uniqueIdentifier
Methods
getTypeName()
staticgetTypeName():TypeName<Asset>
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<Asset>
Overrides
SerializableWithUID.getTypeName
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
SerializableWithUID.getTypeName
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
Inherited from
See also
- Importing and Exporting Guide.
- Image Guide.