# OnBeforeImportFinish

> Raised after files are imported into the project, but before the Asset Database refreshes.

## Definition

* **Type:** Event
* **Namespace:** [UnityEditor.PackageManager.UI](/engine/6000.5/script-reference/unityeditor/packagemanager/ui.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
public static event Action<IReadOnlyList<SampleImportEventData>> OnBeforeImportFinish
```

### Remarks

Subscribe to this event to react to imported samples — for example, by importing dependent samples or packages — before the Asset Database refresh picks up the new files. The event is invoked with a list of [SampleImportEventData](/engine/6000.5/script-reference/unityeditor/packagemanager/ui/sampleimporteventdata.md) describing each imported sample. The event fires once per call to [Sample.Import](/engine/6000.5/script-reference/unityeditor/packagemanager/ui/sample/import.md), regardless of how many samples were imported in that call.

Subscribers are responsible for unsubscribing when they are no longer needed.

```csharp
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.PackageManager.UI;
using UnityEngine;

public static class SampleImportLogger
{
    [InitializeOnLoadMethod]
    static void Subscribe()
    {
        Sample.OnBeforeImportFinish += OnSamplesImported;
    }

    static void OnSamplesImported(IReadOnlyList<SampleImportEventData> events)
    {
        foreach (var data in events)
            Debug.Log($"Imported {data.sampleDisplayName} from {data.packageTechnicalName} to {data.newImportPath}");
    }
}
```

Additional Resources: [SampleImportEventData](/engine/6000.5/script-reference/unityeditor/packagemanager/ui/sampleimporteventdata.md), [Sample.Import](/engine/6000.5/script-reference/unityeditor/packagemanager/ui/sample/import.md)
