Describes a single sample that was imported when the Sample.OnBeforeImportFinish event is raised.
An array of SampleImportEventData is passed to subscribers of Sample.OnBeforeImportFinish, with one entry per sample imported in the originating call to Sample.Import. Use the data to react to imports — for example, by logging the destination path or chaining additional setup work before the Asset Database refresh runs.
using UnityEditor; using UnityEditor.PackageManager.UI; using UnityEngine;
public static class SampleImportLogger { [InitializeOnLoadMethod] static void Subscribe() { Sample.OnBeforeImportFinish += data => { foreach (var entry in data) Debug.Log($"{entry.packageTechnicalName}: {entry.sampleDisplayName} -> {entry.newImportPath}"); }; } }
Additional resources: Sample.OnBeforeImportFinish, Sample
| Property | Description |
|---|---|
| newImportPath | The full path the sample was imported to, under the project's Assets folder. |
| oldImportPath | The path of a previous import of this sample, or `null` if the sample had not been imported before. |
| packageTechnicalName | The technical name (ID) of the package the sample belongs to. |
| sampleDisplayName | The display name of the imported sample. |