Version: 2020.1

AssetDatabase.importPackageStarted

切换到手册

描述

开始导入包时引发的回调。

using UnityEditor;
using UnityEngine;

[InitializeOnLoad] public class AssetDatabaseExamples { static AssetDatabaseExamples() { AssetDatabase.importPackageStarted += OnImportPackageStarted; AssetDatabase.importPackageCompleted += OnImportPackageCompleted; AssetDatabase.importPackageFailed += OnImportPackageFailed; AssetDatabase.importPackageCancelled += OnImportPackageCancelled; }

private static void OnImportPackageCancelled(string packageName) { Debug.Log($"Cancelled the import of package: {packageName}"); }

private static void OnImportPackageCompleted(string packagename) { Debug.Log($"Imported package: {packagename}"); }

private static void OnImportPackageFailed(string packagename, string errormessage) { Debug.Log($"Failed importing package: {packagename} with error: {errormessage}"); }

private static void OnImportPackageStarted(string packagename) { Debug.Log($"Started importing package: {packagename}"); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961