Skip to content

PackageImporter

ClassAssetInventoryAssetInventory.Editor
public sealed class PackageImporter : AssetImporter

Importer for discovering, indexing, and persisting package content in the Asset Inventory catalog.

public Task IndexRough(string path, bool fromAssetStore)

Reads a package.json file and creates or refreshes the corresponding registry-package catalog record.

Parameters

Name Type
path System.String
fromAssetStore System.Boolean

Returns

System.Threading.Tasks.Task

public static bool ApplyTags(Asset asset, Package info, bool fromAssetStore)

Applies package-manager keywords and configured source tags to the supplied catalog package.

Parameters

Name Type
asset AssetInventory.Asset
info AssetInventory.Package
fromAssetStore System.Boolean

Returns

System.Boolean

CreateAsset(Package, string, PackageSource)

Section titled “CreateAsset(Package, string, PackageSource)”
public static Task<Asset> CreateAsset(Package info, string package, PackageSource source)

Creates and persists a catalog package record from parsed registry package metadata and its package source.

Parameters

Name Type
info AssetInventory.Package
package System.String
source UnityEditor.PackageManager.PackageSource

Returns

System.Threading.Tasks.Task{AssetInventory.Asset}

public Task IndexDetails(int assetId = 0)

Refreshes dependency, sample, repository, author, version, and file metadata for one or all registry packages.

Parameters

Name Type
assetId System.Int32

Returns

System.Threading.Tasks.Task

public static Package ReadPackageFile(string package)

Parses package.json from the supplied package directory, returning null when the descriptor cannot be read.

Parameters

Name Type
package System.String

Returns

AssetInventory.Package

public static bool Persist(PackageInfo package)

Creates or updates the catalog record for an installed Unity Package Manager package.

Parameters

Name Type
package UnityEditor.PackageManager.PackageInfo

Returns

System.Boolean

public PackageImporter()