Skip to main content

Editor.Model.AssetImportMetadata

Class

A handle for the metadata of an asset.

Index

Example

export async function findOrCreateAsync(assetManager: Editor.Model.AssetManager, absolutePath: Editor.Path): Promise<Editor.Assets.Asset | null> {
const meta = assetManager.findImportedCopy(absolutePath);
if (meta && !Editor.isNull(meta.primaryAsset)) {
return meta.primaryAsset;
}

const result = await assetManager.importExternalFileAsync(absolutePath);
return Editor.isNull(result.primary) ? null : result.primary;
}

Extends

Properties

assets

readonly assets: Asset[]

A list of all the available assets this handle contains.


assetTreePath

readonly assetTreePath: SourcePath

Source path of this asset within the asset tree.


compressionSettings

compressionSettings: AssetCompressionSettings

Compression strategy applied when this asset is imported; assign an AssetCompressionSettings subclass such as SizeCompressionSettings or DracoCompressionSettings.


id

readonly id: Uuid

The unique id of the entity.

Inherited from

Entity.id


isPackageRoot

readonly isPackageRoot: boolean

Whether this metadata entry represents the root of a native asset package.


isPackedPackageItem

readonly isPackedPackageItem: boolean

Indicates whether this item is packed inside a native package.


meta

readonly meta: Meta

Metadata associated with this entity, providing access to its unique identifier and other descriptive properties.

Inherited from

Entity.meta


nativePackageDescriptor

readonly nativePackageDescriptor: NativePackageDescriptor

Descriptor identifying the native package associated with this import metadata.


nativePackageRoot

readonly nativePackageRoot: AssetImportMetadata

Root AssetImportMetadata entry of the native package containing this item.


packagePolicy

readonly packagePolicy: PackagePolicy

Package policy describing whether and how the native package containing this asset can be unpacked.


primaryAsset

readonly primaryAsset: Asset

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


sourcePath

readonly sourcePath: Path

The source file where the asset was imported from.


topmostNativePackageRoot

readonly topmostNativePackageRoot: AssetImportMetadata

Topmost root AssetImportMetadata in the native package hierarchy.


type

readonly type: string

The entity's type.

Inherited from

Entity.type

Methods

getDirectlyReferencedEntities()

getDirectlyReferencedEntities(): Entity[]

A list of entities which this entity has a reference to.

Returns

Entity[]

Inherited from

Entity.getDirectlyReferencedEntities


getExtraDataItem()

getExtraDataItem(key): string

Retrieves a string value from the extra data store by key.

Parameters

ParameterType
keystring

Returns

string


getMeta()

static getMeta(): Meta

Returns metadata about this type.

Returns

Meta

Inherited from

Entity.getMeta


getNativePackageItems()

getNativePackageItems(iterateOption): AssetImportMetadata[]

Returns child AssetImportMetadata entries within the native package, using the specified iteration depth.

Parameters

ParameterType
iterateOptionPackageIterate

Returns

AssetImportMetadata[]


getOwnedEntities()

getOwnedEntities(): Entity[]

A list of entities which has a reference to this entity.

Returns

Entity[]

Inherited from

Entity.getOwnedEntities


getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

Entity.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

Entity.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

Entity.isOfType


isSame()

isSame(other): boolean

Returns true if this object refers to the same instance as the given object.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

Entity.isSame


setExtraDataItem()

setExtraDataItem(key, value): void

Stores a string value in the extra data store under the given key.

Parameters

ParameterType
keystring
valuestring

Returns

void


staticMeta()

static staticMeta(): Meta

Returns the static metadata descriptor for the AssetImportMetadata type.

Returns

Meta

Nested types

Enumerations

EnumerationDescription
PackageIterateEnum controlling whether native package iteration is shallow or deep.