Skip to content

Receive import results

Last updated

Each time an import request ends, you receive the result through the ImportRequestFinalized event. You are notified once per request, whether it completed, failed, or was cancelled.

The event passes an AmariUnityPackageImportResultContext. Check ImportStatus to see how the request ended.

service.ImportRequestFinalized += result =>
{
switch (result.ImportStatus)
{
case AmariUnityPackagePipelineOperationStatus.Completed:
// result.ImportedAssets contains the paths of the imported assets
break;
case AmariUnityPackagePipelineOperationStatus.Failed:
// Check result.FailureReason and result.ErrorMessage
break;
case AmariUnityPackagePipelineOperationStatus.Cancelled:
// Check result.CancellationReason
break;
}
};
Property Description
Request / PackagePath The processed request and the path of its UnityPackage
Tags The normalized tags
ImportedAssets The paths of the imported assets (Assets/... form, in ascending order)
ImportStatus Completed / Failed / Cancelled
IsCompleted Whether the request completed
CancellationReason Why the request was cancelled. None unless cancelled
FailureReason Why the request failed. None unless failed
ErrorMessage Error details (in English)
  • When a request completes, the pipeline moves on to the next one automatically.
  • When a request fails, it is removed from the queue and the pipeline stops, leaving the remaining requests in the queue. Call StartImport to resume from the next request.
  • When a request is cancelled, the remaining requests are also removed from the queue.
Value Meaning
UnityCancelledEvent Unity reported that the import was cancelled
WindowClosedFallback Detected that the Import Unity Package window was closed before the import started
PipelineReset ResetPipelineAndClearQueue was called
HangTimeoutAfterImportConfirm The import was confirmed with the Enter key in the window, but no import activity was detected within 60 seconds of the request starting
StaleRecovery A request was marked as in progress but was not actually running, and the pipeline recovered

FailureReason has a specific value only when InteractiveMode is true and Unity’s Import Unity Package window types cannot be found (PackageImportWindowTypesUnresolved). For failures like the following, FailureReason is None and the details are in ErrorMessage.

  • A tag contains an unsupported character or is longer than 128 characters
  • The UnityPackage file is not found
  • Unity reported that the import failed
  • Labels could not be added after the import

This package does not show messages to users. Show your own localized messages based on FailureReason and CancellationReason.