//代码控制
public static void ExportPackage(string assetPathName, string fileName, ExportPackageOptions flags);
using System;
namespace UnityEditor
{
/// <summary>
/// <para>Export package option. Multiple options can be combined together using the | operator.</para>
/// </summary>
[Flags]
public enum ExportPackageOptions
{
/// <summary>
/// <para>Default mode. Will not include dependencies or subdirectories nor include Library assets unless specifically included in the asset list.</para>
/// </summary>
Default = 0,
/// <summary>
/// <para>The export operation will be run asynchronously and reveal the exported package file in a file browser window after the export is finished.</para>
/// </summary>
Interactive = 1,
/// <summary>
/// <para>Will recurse through any subdirectories listed and include all assets inside them.</para>
/// </summary>
Recurse = 2,
/// <summary>
/// <para>In addition to the assets paths listed, all dependent assets will be included as well.</para>
/// </summary>
IncludeDependencies = 4,
/// <summary>
/// <para>The exported package will include all library assets, ie. the project settings located in the Library folder of the project.</para>
/// </summary>
IncludeLibraryAssets = 8,
}
}
Default: 默认模式,Include Dependencies 为 false,不包括子目录。
Interactive:交互选项,弹出一个窗口,这个和我们直接用默认导出相比没啥区别。
Recurse:递归选项,意思是说包含子目录。
IncludeDependencies:包含依赖。
IncludeLibraryAssets:包含 ProjectSetting 选项。
这里要注意,fileName 要加上 .unitypacakge 后缀名。
或者使用工具
网友评论