Editor.Model.ImportResult
ClassThe result of Editor.Model.AssetManager.importExternalFile and Editor.Model.AssetManager.importExternalFileAsync.
Index
Example
// ImportResult is returned by AssetManager.importExternalFile().
// It cannot be constructed directly.
const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const assetManager = model.project.assetManager;
// Import an external file into the project
const sourcePath = new Editor.Path('/tmp/my_model.fbx');
const result: Editor.Model.ImportResult = assetManager.importExternalFile(sourcePath);
// Access the primary asset created by the import
if (!Editor.isNull(result.primary)) {
console.log('Primary asset name:', result.primary.name);
}
// The path where the file was imported
console.log('Import path:', result.path.toString());
// Iterate all imported file metadata entries
for (const fileMeta of result.files) {
console.log('Imported file assets:', fileMeta.assets.length);
}
Properties
files
readonlyfiles:AssetImportMetadata[]
The metadata of the files imported.
path
readonlypath:Path
A path to the imported file.
primary
readonlyprimary:Asset
The asset which is usually referenced after the asset has been imported.