美文网首页
C#导出Unity资源包ExportPackage

C#导出Unity资源包ExportPackage

作者: 菜鸟的笔记 | 来源:发表于2020-05-11 10:35 被阅读0次
    //代码控制
    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 后缀名。

    或者使用工具

    相关文章

      网友评论

          本文标题:C#导出Unity资源包ExportPackage

          本文链接:https://www.haomeiwen.com/subject/hcwynhtx.html