A handle for the metadata of an asset.

// Get an asset by either finding an already imported one, or importing it.
export function findOrCreate(assetManager, absolutePath) {
let meta = assetManager.findCopy(absolutePath);
if (meta) {
return meta.primaryAsset;
}

meta = assetManager.importExternalFile(absolutePath);
return meta.primaryAsset;
}
interface AssetImportMetadata {
    assets: Editor.Assets.Asset[];
    id: Uuid;
    primaryAsset: Editor.Assets.Asset;
    sourcePath: Path;
    type: string;
    getDirectlyReferencedEntities(): Entity[];
    getOwnedEntities(): Entity[];
    getTypeName(): string;
    isOfType(type: string): boolean;
    isSame(other: ScriptObject): boolean;
    remapReferences(referenceMapping: object): void;
}

Hierarchy (view full)

Properties

assets: Editor.Assets.Asset[]

A list of all the available assets this handle contains.

id: Uuid

The unique id of the entity.

primaryAsset: Editor.Assets.Asset

The primary asset of this handle. Usually, this is the asset you will assign after accessing an asset.

sourcePath: Path

The source file where the asset was imported from.

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