Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SampleImportEventData

Describes a single sample that was imported when the Sample.OnBeforeImportFinish event is raised.
Read time 1 minuteLast updated 6 days ago

Definition

public struct SampleImportEventData

Remarks

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

Properties

Property

Description

newImportPathThe full path the sample was imported to, under the project's
Assets
folder.
oldImportPathThe path of a previous import of this sample, or
null
if the sample had not been imported before.
packageTechnicalNameThe technical name (ID) of the package the sample belongs to.
sampleDisplayNameThe display name of the imported sample.