[ Web Proxy ]
URL:
Viewing: https://docs.unity3d.com/ScriptReference/PackageManager.UI.SampleImportEventData.html [Back]  [Original]

Unity - Scripting API: SampleImportEventData
Version: Unity 6.5 (6000.5)
    • Supported
    • Legacy
    LanguageEnglish
    • C#

    SampleImportEventData

    struct in UnityEditor.PackageManager.UI

    Suggest a change

    Success!

    Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

    Close

    Submission failed

    For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

    Close
    Your name Your email Suggestion* Submit suggestion

    Cancel

    Switch to Manual

    Description

    Describes a single sample that was imported when the Sample.OnBeforeImportFinish event is raised.

    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
    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.

    Web Proxy Viewer  |  New URL  |  Original Page