SampleImportEventData
Describes a single sample that was imported when the Sample.OnBeforeImportFinish event is raised.
Read time 1 minuteLast updated 7 days ago
Definition
- Type: Struct
- Namespace: UnityEditor.PackageManager.UI
- Assembly: UnityEditor.CoreModule
public struct SampleImportEventData
Remarks
A list 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
Properties
Property | Description |
|---|---|
| newImportPath | The full path the sample was imported to, under the project's |
| oldImportPath | The path of a previous import of this sample, or |
| packageTechnicalName | The technical name (ID) of the package the sample belongs to. |
| sampleDisplayName | The display name of the imported sample. |