// Create the asset
const imageMarker = assetManager.createNativeAsset('ImageMarker', 'Image Marker [EDIT_ME]', destination);

// Ask user for the file they want to use as image marker
import * as Ui from 'LensStudio:Ui';
const gui = pluginSystem.findInterface(Ui.IGui);
const filename = gui.dialogs.selectFileToOpen({ 'caption': 'Select image for the marker', 'filter': '*.png *.jpeg *.jpg' }, '')

// Import the image, and use it as the marker's texture
const importedTextureMeta = await assetManager.importExternalFileAsync(filename, destination, Editor.Model.ResultType.Auto);
imageMarker.texture = importedTextureMeta.primary;
interface ImageMarker {
    fileMeta: AssetImportMetadata;
    height: number;
    id: Uuid;
    name: string;
    texture: FileTexture;
    type: string;
    getDirectlyReferencedEntities(): Entity[];
    getOwnedEntities(): Entity[];
    getTypeName(): string;
    isOfType(type: string): boolean;
    isSame(other: ScriptObject): boolean;
    remapReferences(referenceMapping: object): void;
}

Hierarchy (view full)

Properties

height: number
id: Uuid

The unique id of the entity.

name: string

The name of the asset.

texture: FileTexture
type: string

The entity's type.

Methods

  • Beta

    Parameters

    • type: string

    Returns boolean

  • Beta

    Swap this entity for another one based on a JSON of the current entity id and the target entity id.

    Parameters

    • referenceMapping: object

    Returns void