文档

Unity Engine

Unity Engine

ImportPackage(string, bool)

Imports the package at packagePath into the current project.
阅读时间1 分钟最后更新于 1 个月前

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule
警告
Deprecated. Use UnityEditor.AssetPackage.Package.Import(string packagePath, bool interactive) instead.
public static void ImportPackage(string packagePath, bool interactive)

Parameters

packagePath

The path to the package.

interactive

Set to true to open an import dialog box on import. Set to false to import all assets in the package into the project.

Remarks

Obsolete. Use Package.Import instead.

Examples

using UnityEditor;using UnityEngine;public class AssetDatabaseExamples : MonoBehaviour{ [MenuItem("AssetDatabase/Import Package Example")] static void ImportPackageExample() { var texturePackageNames = new[] {"groundTextures2k.unitypackage", "groundTextures4k.unitypackage"}; foreach (var package in texturePackageNames) { AssetDatabase.ImportPackage(package, false); } }}