Exemple #1
0
 /// <summary>
 /// 自动构建ab
 /// </summary>
 /// <param name="assets"></param>
 /// <param name="outPath"></param>
 /// <param name="abName"></param>
 /// <param name="bbo"></param>
 public static void BuildABs(string[] assets, string outPath, string abName, BuildAssetBundleOptions bbo)
 {
     AssetBundleBuild[] bab = new AssetBundleBuild[1];
     bab[0].assetBundleName = abName;//打包的资源包名称 随便命名
     bab[0].assetNames = assets;
     if (string.IsNullOrEmpty(outPath))
         outPath = GetOutPutPath();
     BuildPipeline.BuildAssetBundles(outPath, bab, bbo, target);
 }
    static void BuildAssetBundles(BuildAssetBundleOptions buildOptions)
    {
        string outputPath = Path.Combine(AssetBundleUtility.AssetBundlesOutputFolder, AssetBundleUtility.GetPlatformName());
        if (!Directory.Exists(outputPath))
        {
            Directory.CreateDirectory(outputPath);
        }

        BuildPipeline.BuildAssetBundles(outputPath, buildOptions, EditorUserBuildSettings.activeBuildTarget);
    }
Exemple #3
0
    static Exporter()
    {
        options = BuildAssetBundleOptions.CollectDependencies
            | BuildAssetBundleOptions.CompleteAssets
            | BuildAssetBundleOptions.UncompressedAssetBundle; //This makes it faster to build & load, but since it is much bigger it will take longer to download.

        buildTarget = EditorUserBuildSettings.activeBuildTarget;

        exportPath = PathUtils.GetAssetBundlesPath ();

        resourcesPath = PathUtils.GetResoucesPath ();
    }
 public static bool BuildAssetBundle(Object mainAsset, Object[] assets, string pathName, out uint crc, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
 {
     crc = 0;
     try
     {
         return BuildAssetBundleInternal(mainAsset, assets, null, pathName, assetBundleOptions, targetPlatform, out crc);
     }
     catch (Exception exception)
     {
         LogBuildExceptionAndExit("BuildPipeline.BuildAssetBundle", exception);
         return false;
     }
 }
    public static void Execute(BuildTarget target, bool buildSeparately, BuildAssetBundleOptions buildAssetOptions)
    {
        var platformPath = BundleCreaterWindow.GetPlatformPath(target);
        if (!Directory.Exists(platformPath))
        {
            Directory.CreateDirectory(platformPath);
        }
        var selectObjs =
            Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets).Where(item => item != Selection.activeObject).ToArray();
        if (!buildSeparately)
        {
            var path = AssetDatabase.GetAssetPath(Selection.activeObject);
            var bundleName = Utils.ConvertToAssetBundleName(path);
            if(bundleName.Contains(".Resources."))
            {
                var index = bundleName.IndexOf(".Resources.");
                bundleName = bundleName.Substring(index + ".Resources.".Length);
            }
            path = platformPath + bundleName;
            path += ".assetbundle";
            BuildPipeline.BuildAssetBundle(null, selectObjs, path, buildAssetOptions);
        }
        else
        {
            // 当前选中的资源列表
            foreach (var o in Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets))
            {
                var path = AssetDatabase.GetAssetPath(o);

                // 过滤掉meta文件和文件夹
                if (path.Contains(".meta") || path.Contains(".") == false)
                    continue;
                var bundleName = Utils.ConvertToAssetBundleName(path);
                if (bundleName.Contains(".Resources."))
                {
                    var index = bundleName.IndexOf(".Resources.");
                    bundleName = bundleName.Substring(index + ".Resources.".Length);
                }
                bundleName = bundleName.Substring(0, bundleName.LastIndexOf('.'));
                bundleName += ".assetbundle";
                path = platformPath + bundleName;
                BuildPipeline.BuildAssetBundle(o, null, path, buildAssetOptions, target);
            }
        }
        AssetDatabase.Refresh();
    }
Exemple #6
0
        /// <summary>
        /// 自动构建ab
        /// </summary>
        /// <param name="assets"></param>
        /// <param name="outPath"></param>
        /// <param name="abName"></param>
        /// <param name="bbo"></param>
        public static void BuildABs(string[] assets, string outPath, string abName, BuildAssetBundleOptions bbo)
        {
            AssetBundleBuild[] bab = new AssetBundleBuild[1];
            bab[0].assetBundleName = abName;//打包的资源包名称 随便命名
            bab[0].assetNames = assets;
            if (string.IsNullOrEmpty(outPath))
                outPath = GetOutPutPath();

            string tmpPath = BuildScript.GetAssetTmpPath();
            string tmpFileName = Path.Combine(tmpPath, abName);
            BuildPipeline.BuildAssetBundles(tmpPath, bab, bbo, target);

            string targetFileName = Path.Combine(outPath, abName);
            FileInfo tInfo = new FileInfo(targetFileName);
            if (tInfo.Exists) tInfo.Delete();
            FileInfo fino = new FileInfo(tmpFileName);
            fino.CopyTo(targetFileName);
        }
Exemple #7
0
    void OnGUI()
    {
        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.BeginVertical();
            GUILayout.Label("Build Bundle Settings", EditorStyles.boldLabel);
            EditorGUI.indentLevel++;
            options = (BuildAssetBundleOptions)EditorGUILayout.EnumMaskField("Asset Bundle Options: ", options);
            targets = (BuildTarget)EditorGUILayout.EnumPopup("Build Target", targets);
            EditorGUI.indentLevel--;
        EditorGUILayout.EndVertical();
        EditorGUILayout.Space();
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        BuildLogic.Option = options;
        BuildLogic.Target = targets;
    }
Exemple #8
0
 private static extern AssetBundleManifest BuildAssetBundlesWithInfoInternal(string outputPath, AssetBundleBuild[] builds, BuildAssetBundleOptions assetBundleOptions, BuildTargetGroup targetPlatformGroup, BuildTarget targetPlatform);
 public BuildAssetBundleOption(string desc, BuildAssetBundleOptions opt)
 {
     option      = opt;
     description = desc;
 }
Exemple #10
0
 public static AssetBundleManifest BuildAssetBundles(string outputPath, AssetBundleBuild[] builds, BuildAssetBundleOptions assetBundleOptions)
 {
     BuildTarget webPlayer = BuildTarget.WebPlayer;
     return BuildAssetBundles(outputPath, builds, assetBundleOptions, webPlayer);
 }
Exemple #11
0
        public static AssetBundleManifest BuildAssetBundles(string outputPath, AssetBundleBuild[] builds, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
        {
            BuildTargetGroup targetPlatformGroup = BuildPipeline.GetBuildTargetGroup(targetPlatform);

            return(BuildAssetBundles(outputPath, builds, assetBundleOptions, targetPlatformGroup, targetPlatform));
        }
 /// <summary>
 /// <para>Build AssetBundles from a building map.</para>
 /// </summary>
 /// <param name="outputPath">Output path for the AssetBundles.</param>
 /// <param name="builds">AssetBundle building map.</param>
 /// <param name="assetBundleOptions">AssetBundle building options.</param>
 /// <param name="targetPlatform">Target build platform.</param>
 /// <returns>
 /// <para>The manifest listing all AssetBundles included in this build.</para>
 /// </returns>
 public static AssetBundleManifest BuildAssetBundles(string outputPath, AssetBundleBuild[] builds, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
 {
     if (!Directory.Exists(outputPath))
     {
         throw new ArgumentException("The output path \"" + outputPath + "\" doesn't exist");
     }
     if (builds == null)
     {
         throw new ArgumentException("AssetBundleBuild cannot be null.");
     }
     return BuildAssetBundlesWithInfoInternal(outputPath, builds, assetBundleOptions, targetPlatform);
 }
 public static bool BuildAssetBundleExplicitAssetNames(UnityEngine.Object[] assets, string[] assetNames, string pathName, BuildAssetBundleOptions assetBundleOptions)
 {
   BuildTarget targetPlatform = BuildTarget.WebPlayer;
   return BuildPipeline.BuildAssetBundleExplicitAssetNames(assets, assetNames, pathName, assetBundleOptions, targetPlatform);
 }
Exemple #14
0
        public static void BuildAssetBundles()
        {
            // Choose the output path according to the build target.
            var outputPath = CreateAssetBundleDirectory();
            const BuildAssetBundleOptions options = BuildAssetBundleOptions.ChunkBasedCompression;
            var targetPlatform      = EditorUserBuildSettings.activeBuildTarget;
            var rules               = GetBuildRules();
            var builds              = rules.GetBuilds();
            var assetBundleManifest = BuildPipeline.BuildAssetBundles(outputPath, builds, options, targetPlatform);

            if (assetBundleManifest == null)
            {
                return;
            }

            var manifest   = GetManifest();
            var dirs       = new List <string> ();
            var assets     = new List <AssetRef> ();
            var bundles    = assetBundleManifest.GetAllAssetBundles();
            var bundle2Ids = new Dictionary <string, int> ();

            for (var index = 0; index < bundles.Length; index++)
            {
                var bundle = bundles [index];
                bundle2Ids [bundle] = index;
            }

            var bundleRefs = new List <BundleRef> ();

            for (var index = 0; index < bundles.Length; index++)
            {
                var bundle = bundles [index];
                var deps   = assetBundleManifest.GetAllDependencies(bundle);
                var path   = string.Format("{0}/{1}", outputPath, bundle);
                if (File.Exists(path))
                {
                    using (var stream = File.OpenRead(path)) {
                        bundleRefs.Add(new BundleRef {
                            name = bundle,
                            id   = index,
                            deps = Array.ConvertAll(deps, input => bundle2Ids [input]),
                            len  = stream.Length,
                            hash = assetBundleManifest.GetAssetBundleHash(bundle).ToString(),
                        });
                    }
                }
                else
                {
                    Debug.LogError(path + " file not exsit.");
                }
            }

            for (var i = 0; i < rules.ruleAssets.Length; i++)
            {
                var item  = rules.ruleAssets [i];
                var path  = item.path;
                var dir   = Path.GetDirectoryName(path).Replace("\\", "/");
                var index = dirs.FindIndex(o => o.Equals(dir));
                if (index == -1)
                {
                    index = dirs.Count;
                    dirs.Add(dir);
                }

                try
                {
                    var asset = new AssetRef
                    {
                        bundle = bundle2Ids[item.bundle], dir = index, name = Path.GetFileName(path)
                    };
                    assets.Add(asset);
                }
                catch (KeyNotFoundException)
                {
                    Debug.LogError($"{Path.GetFileName(path)}资源无法打进AB包");
                }
            }

            manifest.dirs    = dirs.ToArray();
            manifest.assets  = assets.ToArray();
            manifest.bundles = bundleRefs.ToArray();

            EditorUtility.SetDirty(manifest);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            var manifestBundleName = "manifest.unity3d";

            builds = new[] {
                new AssetBundleBuild {
                    assetNames      = new[] { AssetDatabase.GetAssetPath(manifest), },
                    assetBundleName = manifestBundleName
                }
            };

            BuildPipeline.BuildAssetBundles(outputPath, builds, options, targetPlatform);
            ArrayUtility.Add(ref bundles, manifestBundleName);

            Versions.BuildVersions(outputPath, bundles, GetBuildRules().AddVersion());
        }
 public static bool BuildAssetBundleExplicitAssetNames(Object[] assets, string[] assetNames, string pathName, BuildAssetBundleOptions assetBundleOptions)
 {
     return WebPlayerAssetBundlesAreNoLongerSupported();
 }
Exemple #16
0
    public static void Build(UabConfig uabcfg)
    {
        //var abnames = AssetDatabase.GetAllAssetBundleNames();
        //for (int i = 0;i<abnames.Length;i++)
        //{
        //    AssetDatabase.RemoveAssetBundleName(abnames[i],true);
        //    //Debug.LogError("FORCE REMOVE AB NAME :"+ abnames[i]);
        //}

        string targetroot = UabFileUtil.PathCombine(UabEditorDef.UabRoot, UabDef.UAB_BUNDLE_ROOT);

        UabFileUtil.EnsureDir(targetroot);

        for (int i = 0; i < uabcfg.G.Length; i++)
        {
            if (!uabcfg.G[i].enabled)
            {
                continue;
            }
            if (!uabcfg.G[i].isasset)
            {
                continue;
            }


            string[] files = UabCollect.collectFiles(uabcfg.G[i]);
            for (int j = 0; j < files.Length; j++)
            {
                if (!uabcfg.G[i].resourceasset)
                {
                    //Debug.LogWarning("file :" + files[j] + " check depend :");
                    var d = AssetDatabase.GetDependencies(files[j], true);
                    for (int m = 0; m < d.Length; m++)
                    {
                        //Debug.LogError("dependency is " + d[m]);
                        if (!neededRes.Contains(d[m]))
                        {
                            neededRes.Add(d[m]);
                        }
                    }
                }
                else
                {
                    if (!allNotLoadedRes.Contains(files[j]))
                    {
                        allNotLoadedRes.Add(files[j]);
                    }
                }
            }
        }


        //foreach(var res in allNotLoadedRes)
        //{
        //    if (!neededRes.Contains(res))
        //        Debug.LogError("检测到无用资源 :" + res);
        //}


        //return;

        List <UabInfoItem> uabItems = new List <UabInfoItem>();

        List <AssetBundleBuild> abbuilds = new List <AssetBundleBuild>();
        List <UabInfoItem>      items    = null;

        for (int i = 0; i < uabcfg.G.Length; i++)
        {
            if (!uabcfg.G[i].enabled)
            {
                continue;
            }
            if (!uabcfg.G[i].isasset)
            {
                continue;
            }
            List <AssetBundleBuild> l = UabCollect.CollectABBuilds(uabcfg.G[i]);
            if (uabcfg.G[i].name == "video")
            {
                items = buildOnePipeline(l, BuildAssetBundleOptions.UncompressedAssetBundle | BuildAssetBundleOptions.DeterministicAssetBundle);
                if (items == null)
                {
                    return;
                }
                uabItems.AddRange(items);
            }
            else
            {
                abbuilds.AddRange(l);
            }
        }

        BuildAssetBundleOptions op = BuildAssetBundleOptions.ChunkBasedCompression | BuildAssetBundleOptions.DeterministicAssetBundle;

        items = buildOnePipeline(abbuilds, op);
        if (items == null)
        {
            return;
        }
        uabItems.AddRange(items);

        saveUabConfig(uabcfg);
        saveUabInfo(uabItems);

        AssetDatabase.Refresh();

        Debug.Log("uab build success...");
    }
Exemple #17
0
        //
        /// <summary>
        /// 生成AssetBundle
        /// </summary>
        /// <param name="resRootPath"></param>
        /// <param name="outPath"></param>
        /// <param name="target"></param>
        public static void GenAssetBundle(string resRootPath,
                                          string outPath,
                                          BuildTarget target,
                                          BuildAssetBundleOptions options = BuildAssetBundleOptions.ChunkBasedCompression,
                                          bool isClearAssets = true)
        {
            //0.cache path的路径
            cachePath  = IPath.Combine(outPath, "Art/Cache.json");
            configPath = IPath.Combine(outPath, "Art/Config.json");
            //
            var fileList = BApplication.GetAllAssetsPath();

            var artOutpath = IPath.Combine(outPath, "Art");

            //2.分析ab包
            AnalyzeResource(fileList.ToArray(), target, artOutpath);
            //3.生成AssetBundle
            BuildAssetBundle(target, outPath, options);

            //assetBundle 转 hash
            foreach (var item in allfileHashMap)
            {
                var sub    = item.Key.Replace(BApplication.ProjectRoot + "/", "").ToLower();
                var source = IPath.Combine(artOutpath, sub);
                var copyto = IPath.Combine(artOutpath, item.Value);
                if (File.Exists(source) && !File.Exists(copyto))
                {
                    File.Copy(source, copyto);
                }
            }

            Directory.Delete(IPath.Combine(artOutpath, "assets"), true);

            //保存配置
            FileHelper.WriteAllText(configPath, CurManifestConfig.ToString());
            //保存Cache.json
            FileHelper.WriteAllText(cachePath, JsonMapper.ToJson(allfileHashMap, true));

            //4.清除AB Name
            if (isClearAssets)
            {
                RemoveAllAbName();
            }


            //删除无用文件
            var delFiles = Directory.GetFiles(artOutpath, "*", SearchOption.AllDirectories);

            foreach (var df in delFiles)
            {
                var ext = Path.GetExtension(df);
                if (ext == ".meta" || ext == ".manifest")
                {
                    File.Delete(df);
                }

                //避免删除配置
                if (df.EndsWith("Cache.json") || df.EndsWith("Config.json"))
                {
                    continue;
                }

                //
                var fn   = Path.GetFileName(df);
                var item = CurManifestConfig.GetManifestItemByHash(fn);
                if (item == null)
                {
                    File.Delete(df);
                }
            }
        }
Exemple #18
0
    private static List <UabInfoItem> buildOnePipeline(List <AssetBundleBuild> abbuilds, BuildAssetBundleOptions op)
    {
        string targetroot = UabFileUtil.PathCombine(UabEditorDef.UabRoot, UabDef.UAB_BUNDLE_ROOT);

        UabFileUtil.EnsureDir(targetroot);

        AssetBundleManifest abm = BuildPipeline.BuildAssetBundles(targetroot, abbuilds.ToArray(), op, EditorUserBuildSettings.activeBuildTarget);

        if (abm == null)
        {
            Debug.LogError("uab build fail");
            return(null);
        }

        return(createUabInfo(abm));
    }
        public static string BuildHashInfoToJson(BuildAssetBundleOptions varBuildOption)
        {
            var tempInfo = BuildHashInfo(varBuildOption);

            return(JsonFx.Json.JsonWriter.Serialize(tempInfo));
        }
Exemple #20
0
 public static bool BuildAssetBundleExplicitAssetNames(UnityEngine.Object[] assets, string[] assetNames, string pathName, out uint crc, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
 {
     crc = 0;
     try
     {
         return BuildAssetBundleInternal(null, assets, assetNames, pathName, assetBundleOptions, targetPlatform, out crc);
     }
     catch (Exception exception)
     {
         LogBuildExceptionAndExit("BuildPipeline.BuildAssetBundleExplicitAssetNames", exception);
         return false;
     }
 }
        public void PreprocessAllPlatforms(string productName, string companyName, string gameIdentifier,
                                           string applicableGameVersion, int internalResourceVersion, string unityVersion, BuildAssetBundleOptions buildOptions, bool zip,
                                           string outputDirectory, string workingPath, bool outputPackageSelected, string outputPackagePath, bool outputFullSelected, string outputFullPath, bool outputPackedSelected, string outputPackedPath, string buildReportPath)
        {
            string streamingAssetsPath = Utility.Path.GetCombinePath(Application.dataPath, "StreamingAssets");

            string[] fileNames = Directory.GetFiles(streamingAssetsPath, "*", SearchOption.AllDirectories);
            foreach (string fileName in fileNames)
            {
                if (fileName.Contains(".gitkeep"))
                {
                    continue;
                }

                File.Delete(fileName);
            }

            Utility.Path.RemoveEmptyDirectory(streamingAssetsPath);
        }
Exemple #22
0
    static void GenerateAssetBundle(BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform, bool isMutil, bool isCanFileBuild, bool isCanDepenceBuild)
    {
        //获取点击的资源对象的路径
        UnityEngine.Object selectObject = Selection.activeObject;
        if (selectObject == null)
        {
            Debug.Log("没有选中有效对象,请从新选择一个对象!");
            return;
        }
        string selectedObjectPath = AssetDatabase.GetAssetPath(selectObject);

        Debug.Log("选中的对象信息:" + selectObject + ",path " + selectedObjectPath);

        //导出AssetBundle
        AssetBundleBuild[] bundleBuilds = null;

        if (isCanFileBuild)
        {
            string[] depenceAssetPaths = AssetDatabase.GetDependencies(selectedObjectPath);
            Debug.Log("获取依赖的文件数量 " + depenceAssetPaths.Length);
            //支持文件打包
            //判断该路径的合法性
            if (FileHelper.IsFileOrDirectory(selectedObjectPath) != 1)
            {
                Debug.Log("请选择文件类型的对象");
                return;
            }
            bundleBuilds = new AssetBundleBuild[1];
            bundleBuilds[0].assetBundleName = selectObject.name;
            bundleBuilds[0].assetNames      = isCanDepenceBuild ? depenceAssetPaths : new string[] { selectedObjectPath };
        }
        else
        {
            //支持文件夹打包
            //判断该路径的合法性
            if (FileHelper.IsFileOrDirectory(selectedObjectPath) != 2)
            {
                Debug.Log("请选择文件夹类型的对象");
                return;
            }
            if (!isMutil)
            {
                string assetBundleName = selectObject.name;
                Debug.Log(assetBundleName);
                AssetBundleBuild assetsBundleBuild = CreateSimpleAssetBundleBuild(assetBundleName, selectedObjectPath, SearchOption.AllDirectories);
                bundleBuilds    = new AssetBundleBuild[1];
                bundleBuilds[0] = assetsBundleBuild;
            }
            else
            {
                bundleBuilds = CreateMutilBundle(selectedObjectPath);
                Debug.Log("子文件数量 " + bundleBuilds.Length);
            }
        }
        Debug.Log("start build " + bundleBuilds.Length);
        //获取当前资源包的导出路径,如果不存在则创建新的
        string exportPath = EditorUtility.OpenFolderPanel("", "", "");

        //开始打包
        BuildPipeline.BuildAssetBundles(exportPath, bundleBuilds, assetBundleOptions, targetPlatform);
        System.Diagnostics.Process.Start(exportPath);
        AssetDatabase.Refresh();
        Debug.Log("打包成功");
    }
 public static AssetBundleManifest BuildAssetBundles(string outputPath, AssetBundleBuild[] builds, BuildAssetBundleOptions assetBundleOptions)
 {
   BuildTarget targetPlatform = BuildTarget.WebPlayer;
   return BuildPipeline.BuildAssetBundles(outputPath, builds, assetBundleOptions, targetPlatform);
 }
        public static AssetBundleBuildsManifest BuildAssetBundles(string outputDir, BuildAssetBundleOptions buildOption, BuildTarget targetPlatform)
        {
#if ASSET_BUNDLE_BUILD_TIME_CHECK
            float startTime = Time.realtimeSinceStartup;
#endif

            AssetBundleBuildsManifest manifest = new AssetBundleBuildsManifest();

            AssetBundleManifest unityManifest = null;
            // append
            AllAssetBundleInformation allAssetBundleInfo = GetAllAssetBundleInfoList();
            int allAssetBundleCount = AssetDatabase.GetAllAssetBundleNames().Length;
            //
            List <AssetBundleBuild> buildTargetBuffer = new List <AssetBundleBuild>();

#if ASSET_BUNDLE_BUILD_TIME_CHECK
            float groupingComplete = Time.realtimeSinceStartup;
#endif


            /// Build NoDependAssetBundles
            int idx = 0;
            foreach (var noDependAssetBundle in allAssetBundleInfo.noDependList)
            {
                string assetBundleName = noDependAssetBundle.assetBundleName;
                buildTargetBuffer.Add(CreateAssetBundleBuildFromAssetBundleName(assetBundleName));
                if (buildTargetBuffer.Count > BulkConvertNum)
                {
#if ASSET_BUNDLE_GROUPING_DEBUG
                    DebugPrintBuildPipeline(buildTargetBuffer);
#endif
                    unityManifest = BuildPipeline.BuildAssetBundles(outputDir, buildTargetBuffer.ToArray(), buildOption, targetPlatform);
                    manifest.AddUnityManifest(unityManifest);
                    buildTargetBuffer.Clear();
                }
                ++idx;
                EditorUtility.DisplayProgressBar("process no dependence bundles", assetBundleName, (float)idx / (float)allAssetBundleCount);
            }
            if (buildTargetBuffer.Count > 0)
            {
#if ASSET_BUNDLE_GROUPING_DEBUG
                DebugPrintBuildPipeline(buildTargetBuffer);
#endif
                unityManifest = BuildPipeline.BuildAssetBundles(outputDir, buildTargetBuffer.ToArray(), buildOption, targetPlatform);
                manifest.AddUnityManifest(unityManifest);
                buildTargetBuffer.Clear();
            }

            // group set
            var dependGroupList = new List <List <AssetBundleInfoWithDepends> >(allAssetBundleInfo.dependGroup.Values);
            int length          = dependGroupList.Count;

            for (int i = 0; i < length; ++i)
            {
                string assetBundleName = "";
                foreach (var assetBundle in dependGroupList[i])
                {
                    assetBundleName = assetBundle.assetBundleName;
                    buildTargetBuffer.Add(CreateAssetBundleBuildFromAssetBundleName(assetBundleName));
                    ++idx;
                }
                bool buildFlag = false;
                buildFlag |= (buildTargetBuffer.Count > BulkConvertNum);
                buildFlag |= (i == length - 1);
                if (i < length - 1)
                {
                    buildFlag |= (dependGroupList[i + 1].Count > BulkConvertNum);
                }

                if (buildFlag)
                {
#if ASSET_BUNDLE_GROUPING_DEBUG
                    DebugPrintBuildPipeline(buildTargetBuffer);
#endif
                    unityManifest = BuildPipeline.BuildAssetBundles(outputDir, buildTargetBuffer.ToArray(), buildOption, targetPlatform);
                    manifest.AddUnityManifest(unityManifest);
                    buildTargetBuffer.Clear();
                }
                EditorUtility.DisplayProgressBar("process dependence", "group " + i + " " + assetBundleName, (float)idx / (float)allAssetBundleCount);
            }
            EditorUtility.ClearProgressBar();
#if ASSET_BUNDLE_BUILD_TIME_CHECK
            float buildCompleteTime = Time.realtimeSinceStartup;

            UnityEngine.Debug.Log("All BuildTime:" + (buildCompleteTime - startTime) + "sec\n" +
                                  "GroupingTime:" + (groupingComplete - startTime) + "sec\n" +
                                  "AssetBundleBuild:" + (buildCompleteTime - groupingComplete) + "sec\n");
#endif
            return(manifest);
        }
 private static extern bool BuildAssetBundleInternal(Object mainAsset, Object[] assets, string[] assetNames, string pathName, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform, out uint crc);
Exemple #26
0
        private static void ExpResAssetBundle(string terrainDestDir)
        {
            m_depBundleList.Clear();

            Dictionary <string, string> assetPathBundleMap = new Dictionary <string, string>();

            BuildAssetBundleOptions assetOp = BuildAssetBundleOptions.CollectDependencies |
                                              BuildAssetBundleOptions.CompleteAssets;
            int idx = 0;

            foreach (List <string> pathList in m_depAssetPathList)
            {
                List <UnityEngine.Object> expAssetList = new List <UnityEngine.Object>();

                string bundleName = RES_ASSET_PREFIX + EditorSceneExporter.GetSceneNameWithoutExtension()
                                    + "_" + idx + BUNDLE_EXT;
                string        bundlePath = Path.Combine(terrainDestDir, bundleName);
                List <string> depBundles = new List <string>();
                foreach (string assetName in pathList)
                {
                    if (assetPathBundleMap.ContainsKey(assetName))
                    {
                        string existBundleName = assetPathBundleMap[assetName];
                        if (!depBundles.Contains(existBundleName))
                        {
                            depBundles.Add(existBundleName);
                        }
                    }
                    else
                    {
                        assetPathBundleMap.Add(assetName, bundleName);
                        if (!depBundles.Contains(bundleName))
                        {
                            depBundles.Add(bundleName);
                        }

                        UnityEngine.Object asset = AssetDatabase.LoadMainAssetAtPath(assetName);
                        expAssetList.Add(asset);
                    }
                }
                m_depBundleList.Add(depBundles);

                if (expAssetList.Count <= 0)
                {
                    continue;
                }

                BuildPipeline.BuildAssetBundle(null, expAssetList.ToArray(),
                                               bundlePath, assetOp,
                                               GOEPack.buildTarget);
                idx++;
            }

            m_depBundleAssetMap.Clear();
            foreach (string asset in assetPathBundleMap.Keys)
            {
                string[] arr    = asset.Split(char.Parse("/"));
                string   name   = arr[arr.Length - 1];
                string   bundle = assetPathBundleMap[asset];
                if (m_depBundleAssetMap.ContainsKey(bundle))
                {
                    List <string> assets = m_depBundleAssetMap[bundle];
                    if (!assets.Contains(name))
                    {
                        m_depBundleAssetMap[bundle].Add(name);
                    }
                }
                else
                {
                    m_depBundleAssetMap.Add(bundle, new List <string>());
                    m_depBundleAssetMap[bundle].Add(name);
                }
            }
        }
 public static bool BuildAssetBundle(Object mainAsset, Object[] assets, string pathName, out uint crc, BuildAssetBundleOptions assetBundleOptions)
 {
     crc = 0;
     return WebPlayerAssetBundlesAreNoLongerSupported();
 }
Exemple #28
0
        public void OnPreprocessAllPlatforms(string productName, string companyName, string gameIdentifier, string gameFrameworkVersion, string unityVersion, string applicableGameVersion, int internalResourceVersion,
                                             Platform platforms, AssetBundleCompressionType assetBundleCompression, string compressionHelperTypeName, bool additionalCompressionSelected, bool forceRebuildAssetBundleSelected, string buildEventHandlerTypeName, string outputDirectory, BuildAssetBundleOptions buildAssetBundleOptions,
                                             string workingPath, bool outputPackageSelected, string outputPackagePath, bool outputFullSelected, string outputFullPath, bool outputPackedSelected, string outputPackedPath, string buildReportPath)
        {
            string streamingAssetsPath = Utility.Path.GetRegularPath(Path.Combine(Application.dataPath, "StreamingAssets"));

            string[] fileNames = Directory.GetFiles(streamingAssetsPath, "*", SearchOption.AllDirectories);
            foreach (string fileName in fileNames)
            {
                if (fileName.Contains(".gitkeep"))
                {
                    continue;
                }

                File.Delete(fileName);
            }

            Utility.Path.RemoveEmptyDirectory(streamingAssetsPath);
        }
Exemple #29
0
 public static bool BuildAssetBundleExplicitAssetNames(UnityEngine.Object[] assets, string[] assetNames, string pathName, out uint crc, BuildAssetBundleOptions assetBundleOptions)
 {
     BuildTarget webPlayer = BuildTarget.WebPlayer;
     return BuildAssetBundleExplicitAssetNames(assets, assetNames, pathName, out crc, assetBundleOptions, webPlayer);
 }
Exemple #30
0
 public void OnPostprocessAllPlatforms(string productName, string companyName, string gameIdentifier, string gameFrameworkVersion, string unityVersion, string applicableGameVersion, int internalResourceVersion,
                                       Platform platforms, AssetBundleCompressionType assetBundleCompression, string compressionHelperTypeName, bool additionalCompressionSelected, bool forceRebuildAssetBundleSelected, string buildEventHandlerTypeName, string outputDirectory, BuildAssetBundleOptions buildAssetBundleOptions,
                                       string workingPath, bool outputPackageSelected, string outputPackagePath, bool outputFullSelected, string outputFullPath, bool outputPackedSelected, string outputPackedPath, string buildReportPath)
 {
 }
Exemple #31
0
#pragma warning restore 618

        private static extern bool BuildAssetBundleInternal(UnityEngine.Object mainAsset, UnityEngine.Object[] assets, string[] assetNames, string pathName, BuildAssetBundleOptions assetBundleOptions, BuildTargetGroup targetPlatformGroup, BuildTarget targetPlatform, out uint crc);
    static private List <AssetBundleBuild> BuildUnitAssetBundles(BuildAssetBundleOptions opt,
                                                                 BuildTarget biuldTarget,
                                                                 Dictionary <string, AssetBundleInfo> assetInfoDict,
                                                                 string outputPath)
    {
        Debug.Log("處理資源: Unit");

        //讀取UnitConfig配置文件,只有這個文件配置的Unit才會記錄在reslist.json裡

        string      text   = File.ReadAllText(string.Format("{0}/Config/UnitConfig.xml", ASSET_BUNDLE_SRC_DIR));
        XMLInStream stream = new XMLInStream(text);

        Dictionary <string, UnitConfig> UnitConfigs = new Dictionary <string, UnitConfig>();

        stream.List("item", delegate(XMLInStream itemStream)
        {
            UnitConfig ufg = new UnitConfig(itemStream);

            //注意這裡用的是ResourceIcon字段
            if (!UnitConfigs.ContainsKey(ufg.ResourceIcon))
            {
                UnitConfigs.Add(ufg.ResourceIcon, ufg);
            }
        });

        List <AssetBundleBuild> ret = new List <AssetBundleBuild>();

        //生成prefab的AssetBundle
        foreach (var pair in UnitConfigs)
        {
            DirectoryInfo dInfo = new DirectoryInfo(string.Format("{0}/Unit/{1}", ASSET_BUNDLE_SRC_DIR, pair.Key));

            //這裡注意轉成小寫
            string assetbundlename = "unit/" + pair.Key.ToLower();
            if (!dInfo.Exists)
            {
                // 如果UnitConfig配置裡沒有的字段,需要從reslist.json裡清理掉
                if (assetInfoDict.ContainsKey(assetbundlename))
                {
                    assetInfoDict.Remove(assetbundlename);
                }
                continue;
            }

            AssetBundleBuild abb = new AssetBundleBuild();
            abb.assetBundleName = assetbundlename;
            string[] assetNames = { string.Format("{0}/Unit/{1}/{2}.prefab", ASSET_BUNDLE_SRC_DIR, pair.Key, pair.Key) };
            abb.assetNames = assetNames;
            ret.Add(abb);
        }

        //生成UnitImg的AssetBundle
        foreach (var pair in UnitConfigs)
        {
            //夥伴圖1
            string p1 = string.Format("{0}/UnitImg1/{1}.png", ASSET_BUNDLE_SRC_DIR, pair.Key);
            //夥伴圖2
            string   p2              = string.Format("{0}/UnitImg2/{1}.png", ASSET_BUNDLE_SRC_DIR, pair.Key);
            FileInfo img1Info        = new FileInfo(p1);
            FileInfo img2Info        = new FileInfo(p2);
            string   assetbundlename = string.Format("unitimg/{0}img", pair.Key.ToLower());
            if (!img1Info.Exists && !img2Info.Exists)
            {
                continue;
            }

            AssetBundleBuild abb = new AssetBundleBuild();
            abb.assetBundleName = assetbundlename;
            string[] assetNames = { p1, p2 };
            abb.assetNames = assetNames;
            ret.Add(abb);
        }

        return(ret);
    }
Exemple #33
0
        internal static AssetBundleManifest BuildAssetBundles(string outputPath, AssetBundleBuild[] builds, BuildAssetBundleOptions assetBundleOptions, BuildTargetGroup targetPlatformGroup, BuildTarget targetPlatform)
        {
            if (isBuildingPlayer)
            {
                throw new InvalidOperationException("Cannot build asset bundles while a build is in progress.");
            }

            if (!System.IO.Directory.Exists(outputPath))
            {
                throw new ArgumentException("The output path \"" + outputPath + "\" doesn't exist");
            }

            if (builds == null)
            {
                throw new ArgumentException("AssetBundleBuild cannot be null.");
            }

            return(BuildAssetBundlesWithInfoInternal(outputPath, builds, assetBundleOptions, targetPlatformGroup, targetPlatform));
        }
    static private void BuildAllAssetBundle(BuildAssetBundleOptions opt, BuildTarget biuldTarget, string outputDir)
    {
        int reslistVer = 0;
        List <AssetBundleBuild> builds = new List <AssetBundleBuild>();
        FileInfo reslistFileInfo       = null;
        Dictionary <string, AssetBundleInfo> reslistData = LoadResConf(outputDir, out reslistVer, out reslistFileInfo);

        //Unit资源
        builds.AddRange(BuildUnitAssetBundles(opt, biuldTarget, reslistData, outputDir));
        //数据配置
        builds.Add(BuildConfAB(opt, biuldTarget, outputDir));
        //关卡配置
        builds.Add(BuildLevelConfAB(opt, biuldTarget, outputDir));
        //Audio
        builds.AddRange(BuildAudioAB(opt, biuldTarget, outputDir));

        if (builds.Count == 0)
        {
            Debug.LogFormat("沒有資源需要導出AssetBundle");
            return;
        }

        AssetBundleManifest manifest =
            BuildPipeline.BuildAssetBundles(outputDir, builds.ToArray(), opt, biuldTarget);

        if (manifest == null)
        {
            Debug.LogWarning("Manifest == null");
            return;
        }

        string[] assetBundles = manifest.GetAllAssetBundles();
        bool     hasChange    = false;
        Dictionary <string, AssetBundleInfo> newReslistData = new Dictionary <string, AssetBundleInfo>();

        for (int i = 0, n = assetBundles.Length; i < n; i++)
        {
            string assetbundlename = assetBundles[i];
            string hash            = manifest.GetAssetBundleHash(assetbundlename).ToString();
            int    version         = 0;
            if (!reslistData.ContainsKey(assetbundlename))
            {
                version = 1;
            }
            else if ((string)reslistData[assetbundlename].Hash != hash)
            {
                version = (int)reslistData[assetbundlename].Version + 1;
            }
            else
            {
                version = (int)reslistData[assetbundlename].Version;
                //Debug.LogWarningFormat("{0} hash相同", assetbundlename);
            }

            AssetBundleInfo info = new AssetBundleInfo();
            info.Path    = assetbundlename;
            info.Version = version;


            FileInfo fInfo = new FileInfo(outputDir + "/" + assetbundlename);
            info.Size     = (int)(fInfo.Length / 1024);
            info.Hash     = hash;
            info.Packaged = false;
            newReslistData.Add(assetbundlename, info);
            hasChange = true;
        }

        Debug.LogFormat("AssetBundle總量{0}", newReslistData.Count);

        if (hasChange)
        {
            SaveReslist(reslistFileInfo, newReslistData, reslistVer + 1);
        }
        else
        {
            SaveReslist(reslistFileInfo, newReslistData, reslistVer);
        }

        Debug.Log("處理完成");
    }
Exemple #35
0
        public virtual void Build(string outputPath, BuildTarget buildTarget, BuildAssetBundleOptions options, string version, List <IBundleModifier> bundleModifierChain = null)
        {
            if (EditorUserBuildSettings.activeBuildTarget != buildTarget)
            {
                if (!EditorUserBuildSettings.SwitchActiveBuildTarget(BuildPipeline.GetBuildTargetGroup(buildTarget), buildTarget))
                {
                    throw new System.Exception("Switch BuildTarget failure.");
                }
            }

            if (string.IsNullOrEmpty(outputPath))
            {
                throw new System.ArgumentNullException("outputPath");
            }

            if (string.IsNullOrEmpty(version))
            {
                throw new System.ArgumentNullException("version");
            }


            string platformOutput = this.GetPlatformOutput(outputPath, buildTarget);
            string genOutput      = this.GetGenOutput(outputPath, buildTarget);
            string versionOutput  = this.GetVersionOutput(outputPath, buildTarget, version);

            if (((options & BuildAssetBundleOptions.ForceRebuildAssetBundle) > 0) && Directory.Exists(genOutput))
            {
                Directory.Delete(genOutput, true);
            }

            if (Directory.Exists(versionOutput))
            {
                Directory.Delete(versionOutput, true);
            }

            if (!Directory.Exists(genOutput))
            {
                Directory.CreateDirectory(genOutput);
            }

            if (!Directory.Exists(versionOutput))
            {
                Directory.CreateDirectory(versionOutput);
            }

            AssetBundleManifest manifest = BuildPipeline.BuildAssetBundles(genOutput, options, buildTarget);

            if (manifest == null)
            {
                throw new System.Exception("Build failure.");
            }

#if UNITY_5_6_OR_NEWER
            if ((options & BuildAssetBundleOptions.DryRunBuild) > 0)
            {
                return;
            }
#endif

            try
            {
                AssetDatabase.StartAssetEditing();

                BundleManifest    lastVersionBundleManifest = this.GetPreviousBundleManifest(outputPath, buildTarget, version);
                List <BundleInfo> lastBundles = new List <BundleInfo>();
                if (lastVersionBundleManifest != null)
                {
                    lastBundles.AddRange(lastVersionBundleManifest.GetAll());
                }

                BundleManifest bundleManifest = this.CreateBundleManifest(genOutput, manifest, version);

                bundleManifest = this.CopyAssetBundle(bundleManifest, new DirectoryInfo(genOutput), new DirectoryInfo(versionOutput), bundleModifierChain);
                File.WriteAllText(string.Format("{0}/{1}", versionOutput, BundleSetting.ManifestFilename), bundleManifest.ToJson());

                File.WriteAllText(string.Format("{0}/{1}_{2}.csv", platformOutput, ManifestPrefix, version), this.ToCSV(lastBundles.ToArray(), bundleManifest.GetAll()));
            }
            finally
            {
                AssetDatabase.StopAssetEditing();
            }
        }
        private void ExecuteBuild()
        {
            if (AssetBundleModel.Model.DataSource.CanSpecifyBuildOutputDirectory)
            {
                if (string.IsNullOrEmpty(m_UserData.m_OutputPath))
                {
                    BrowseForFolder();
                }

                if (string.IsNullOrEmpty(m_UserData.m_OutputPath)) //in case they hit "cancel" on the open browser
                {
                    Debug.LogError("AssetBundle Build: No valid output path for build.");
                    return;
                }

                if (m_ForceRebuild.state)
                {
                    string message = "Do you want to delete all files in the directory " + m_UserData.m_OutputPath;
                    if (m_CopyToStreaming.state)
                    {
                        message += " and " + m_streamingPath;
                    }
                    message += "?";
                    //if (EditorUtility.DisplayDialog("File delete confirmation", message, "Yes", "No"))
                    //{
                    try
                    {
                        if (Directory.Exists(m_UserData.m_OutputPath))
                        {
                            Directory.Delete(m_UserData.m_OutputPath, true);
                        }

                        if (m_CopyToStreaming.state)
                        {
                            if (Directory.Exists(m_streamingPath))
                            {
                                Directory.Delete(m_streamingPath, true);
                            }
                        }
                    }
                    catch (System.Exception e)
                    {
                        Debug.LogException(e);
                    }
                    //}
                }
                if (!Directory.Exists(m_UserData.m_OutputPath))
                {
                    Directory.CreateDirectory(m_UserData.m_OutputPath);
                }
            }

            BuildAssetBundleOptions opt = BuildAssetBundleOptions.None;

            if (AssetBundleModel.Model.DataSource.CanSpecifyBuildOptions)
            {
                if (m_UserData.m_Compression == CompressOptions.Uncompressed)
                {
                    opt |= BuildAssetBundleOptions.UncompressedAssetBundle;
                }
                else if (m_UserData.m_Compression == CompressOptions.ChunkBasedCompression)
                {
                    opt |= BuildAssetBundleOptions.ChunkBasedCompression;
                }
                foreach (var tog in m_ToggleData)
                {
                    if (tog.state)
                    {
                        opt |= tog.option;
                    }
                }
            }

            ABBuildInfo buildInfo = new ABBuildInfo();

            buildInfo.outputDirectory = m_UserData.m_OutputPath;
            buildInfo.options         = opt;
            buildInfo.buildTarget     = (BuildTarget)m_UserData.m_BuildTarget;

            AssetBundleModel.Model.DataSource.BuildAssetBundles(buildInfo);

            AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);

            if (m_CopyToStreaming.state)
            {
                DirectoryCopy(m_UserData.m_OutputPath, m_streamingPath);
            }
        }
Exemple #37
0
        public static void BuildAssetBundles()
        {
            var assetManifest = GetManifest();

            BuildScript.RemoveUnusedAssetBundleNames();

            var assets           = assetManifest.assets;
            var assetBundleNames = assetManifest.bundles;
            var dirs             = assetManifest.dirs;

            var map = new Dictionary <string, List <string> >();

            foreach (var item in assetManifest.bundles)
            {
                map[item] = new List <string>();
            }

            foreach (var item in assets)
            {
                var assetPath = dirs[item.dir] + "/" + item.name;
                map[assetBundleNames[item.bundle]].Add(assetPath);
            }

            List <AssetBundleBuild> builds = new List <AssetBundleBuild>();

            foreach (var item in map)
            {
                builds.Add(new AssetBundleBuild()
                {
                    assetBundleName = item.Key,
                    assetNames      = item.Value.ToArray()
                });
            }

            // Choose the output path according to the build target.
            var outputPath = CreateAssetBundleDirectory();

            const BuildAssetBundleOptions options = BuildAssetBundleOptions.ChunkBasedCompression;

            var manifest =
                BuildPipeline.BuildAssetBundles(outputPath, builds.ToArray(), options,
                                                EditorUserBuildSettings.activeBuildTarget);
            var versionsTxt = outputPath + "/versions.txt";
            var versions    = new Dictionary <string, string>();

            LoadVersions(versionsTxt, versions);

            var buildVersions = GetVersions(manifest);

            var updates = new List <string>();

            foreach (var item in buildVersions)
            {
                string hash;
                var    isNew = true;
                if (versions.TryGetValue(item.Key, out hash))
                {
                    if (hash.Equals(item.Value))
                    {
                        isNew = false;
                    }
                }
                if (isNew)
                {
                    updates.Add(item.Key);
                }
            }

            if (updates.Count > 0)
            {
                using (var s = new StreamWriter(File.Open(outputPath + "/updates.txt", FileMode.Append)))
                {
                    s.WriteLine(DateTime.Now.ToFileTime() + ":");
                    foreach (var item in updates)
                    {
                        s.WriteLine(item);
                    }
                    s.Flush();
                    s.Close();
                }

                SaveVersions(versionsTxt, buildVersions);
            }
            else
            {
                Debug.Log("nothing to update.");
            }

            string[] ignoredFiles = { GetPlatformName(), "versions.txt", "updates.txt", "manifest" };

            var files = Directory.GetFiles(outputPath, "*", SearchOption.AllDirectories);

            var deletes = (from t in files
                           let file = t.Replace('\\', '/').Replace(outputPath.Replace('\\', '/') + '/', "")
                                      where !file.EndsWith(".manifest", StringComparison.Ordinal) && !Array.Exists(ignoredFiles, s => s.Equals(file))
                                      where !buildVersions.ContainsKey(file)
                                      select t).ToList();

            foreach (var delete in deletes)
            {
                if (!File.Exists(delete))
                {
                    continue;
                }
                File.Delete(delete);
                File.Delete(delete + ".manifest");
            }

            deletes.Clear();
        }
    static void BuildAssets(BuildAssetBundleOptions options, BuildTarget target)
    {
        RemoveAssetBundleNames();
        string path             = "Assets/StreamingAssets";
        string rawResourcesPath = "Assets/RawResources";

        string[] allFiles = System.IO.Directory.GetFiles(rawResourcesPath, "*", System.IO.SearchOption.AllDirectories);

        List <string> rawResources = new List <string>();

        Dictionary <string, Depend> references = new Dictionary <string, Depend>();

        for (int i = 0; i < allFiles.Length; i++)
        {
            AssetImporter assetImporter = AssetImporter.GetAtPath(allFiles[i]);
            if (assetImporter)
            {
                string rawResource = allFiles[i].Replace(@"\", "/");
                string extension   = System.IO.Path.GetExtension(rawResource);
                rawResources.Add(rawResource);
                if (IsSceneDepend(rawResource))
                {
                    continue;
                }
                assetImporter.assetBundleName = rawResource.Replace(extension, "").Replace(rawResourcesPath + "/", "");
                //assetImporter.assetBundleVariant = extension.Replace(".", "");
            }
        }

        for (int i = 0; i < rawResources.Count; i++)
        {
            GetDependencies(rawResources[i], references, rawResources);
        }

        AddCustomDependencies(references, "Assets/AssetsLibrary/ui/common2", "common2");

        foreach (Depend depend in references.Values)
        {
            AssetImporter assetImporter = AssetImporter.GetAtPath(depend.path);
            if (assetImporter)
            {
                if (depend.path.EndsWith(".cs"))
                {
                    continue;
                }
                if (IsSceneDepend(depend.path))
                {
                    continue;
                }
                if (rawResources.Contains(depend.path))
                {
                    continue;
                }
                if (assetImporter is TextureImporter)
                {
                    var textureImporter = assetImporter as TextureImporter;
                    if (textureImporter.textureType == TextureImporterType.Sprite)
                    {
                        if (string.IsNullOrEmpty(textureImporter.spritePackingTag) == false)
                        {
                            assetImporter.assetBundleName = "common/" + textureImporter.spritePackingTag;
                        }
                        else
                        {
                            assetImporter.assetBundleName = "common/" + System.IO.Path.GetFileNameWithoutExtension(depend.path);
                        }
                        continue;
                    }
                }

                if (depend.owner == null)
                {
                    continue;
                }

                string extension = System.IO.Path.GetExtension(depend.owner);
                assetImporter.assetBundleName = depend.owner.Replace(extension, "").Replace(rawResourcesPath + "/", "");
                //assetImporter.assetBundleVariant = extension.Replace(".","");
            }
        }

        if (System.IO.Directory.Exists(path) == false)
        {
            System.IO.Directory.CreateDirectory(path);
        }

        AssetBundleManifest manifest = BuildPipeline.BuildAssetBundles(path, options | BuildAssetBundleOptions.DisableWriteTypeTree, target);

        Clear(manifest);
        RemoveAssetBundleNames();
        AssetDatabase.Refresh();
    }
 public void PostprocessAllPlatforms(string productName, string companyName, string gameIdentifier,
                                     string applicableGameVersion, int internalResourceVersion, string unityVersion, BuildAssetBundleOptions buildOptions, bool zip,
                                     string outputDirectory, string workingPath, bool outputPackageSelected, string outputPackagePath, bool outputFullSelected, string outputFullPath, bool outputPackedSelected, string outputPackedPath, string buildReportPath)
 {
 }
 static public void RebuildAll(BuildAssetBundleOptions options, BuildTarget target)
 {
     BuildAssetsWithBuildTarget(options, target);
     MakeMD5(target);
 }
		/*--------------------------------------------------*/
		/// <summary>
		/// 掃き出し設定ウィンドウの中身.
		/// </summary>
		/*--------------------------------------------------*/
		void OnGUI()
		{
			MolExtendGUI.Horizontal(
				() => {
					GUILayout.Label("フォルダ名", GUILayout.Width(100));
					folder = GUILayout.TextField(folder);
				}
			);

			MolExtendGUI.Horizontal(
				() => {
					option = (BuildAssetBundleOptions)MolExtendGUI.EnumPopup(option);
					bt = (Target)MolExtendGUI.EnumPopup(bt);
				}
			);

			if (GUILayout.Button("アセットバンドルのビルド"))
			{ BundleBuild(); }
		}
        public static void ExportAvatarBundle()
        {
            GameObject obj = Selection.activeGameObject;
            string     error;

            if (!AvatarCheck.CheckAvatar(obj, out error))
            {
                EditorUtility.DisplayDialog("Export Avatar Bundle", error, "OK");
                return;
            }

            string fullpath = EditorUtility.SaveFilePanel("Export Avatar Bundle", ".", obj.name, "vsfavatar");

            if (fullpath == null || fullpath == "")
            {
                return;
            }

            string filename = Path.GetFileName(fullpath);

            bool   complete   = false;
            string prefabPath = "Assets/VSFAvatarTemporary.prefab";

            try {
                AssetDatabase.DeleteAsset(prefabPath);
                if (File.Exists(prefabPath))
                {
                    File.Delete(prefabPath);
                }

                bool succeededPack = false;
                PrefabUtility.SaveAsPrefabAsset(obj, prefabPath, out succeededPack);
                if (!succeededPack)
                {
                    Debug.Log("Prefab creation failed");
                    return;
                }

                AssetBundleBuild bundleBuild = new AssetBundleBuild();
                AssetDatabase.RemoveUnusedAssetBundleNames();
                bundleBuild.assetBundleName  = filename;
                bundleBuild.assetNames       = new string[] { prefabPath };
                bundleBuild.addressableNames = new string[] { "VSFAvatar" };

                BuildAssetBundleOptions options = BuildAssetBundleOptions.ForceRebuildAssetBundle | BuildAssetBundleOptions.DeterministicAssetBundle | BuildAssetBundleOptions.StrictMode;
                if (obj.GetComponentsInChildren <UnityEngine.Video.VideoPlayer>(true).Length > 0)
                {
                    Debug.Log("VideoPlayer detected, using uncompressed asset bundle.");
                    options = options | BuildAssetBundleOptions.UncompressedAssetBundle;
                }
                BuildPipeline.BuildAssetBundles(Application.temporaryCachePath, new AssetBundleBuild[] { bundleBuild }, options, BuildTarget.StandaloneWindows);
                if (File.Exists(fullpath))
                {
                    File.Delete(fullpath);
                }
                File.Move(Application.temporaryCachePath + "/" + filename, fullpath);

                EditorUtility.DisplayDialog("Export", "Export complete!", "OK");
                complete = true;
            }
            finally
            {
                try {
                    AssetDatabase.DeleteAsset(prefabPath);
                    if (File.Exists(prefabPath))
                    {
                        File.Delete(prefabPath);
                    }
                } catch {}

                if (!complete)
                {
                    EditorUtility.DisplayDialog("Export", "Export failed! See the console for details.", "OK");
                }
            }
        }
 public static bool BuildAssetBundleExplicitAssetNames(Object[] assets, string[] assetNames, string pathName, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
 {
     uint num;
     return BuildAssetBundleExplicitAssetNames(assets, assetNames, pathName, out num, assetBundleOptions, targetPlatform);
 }
Exemple #44
0
        static void OnToolsGUI(string rootNs, string viewNs, string constNs, string dataNs, string autoDir,
                               string scriptDir)
        {
            EditorGUILayout.Space();
            _resourceManagerType = (ResourceManagerType)EditorGUILayout.EnumPopup("资源加载类型", _resourceManagerType);

            switch (_resourceManagerType)
            {
                #region ResourceManagerType.Resource

            case ResourceManagerType.Resource:

                EditorGUILayout.LabelField("自动常量文件生成目录",
                                           Application.dataPath + "/" + rootNs + "/" + constNs + "/" + autoDir);
                EditorGUILayout.LabelField("常量工具类生成目录",
                                           Application.dataPath + "/" + rootNs + "/Utility/" + autoDir + "/ConstUtil.cs");
                EditorGUILayout.Space();

                createPathFile = EditorGUILayout.Toggle("是否生成资源路径文件", createPathFile);
                EditorGUILayout.Space();

                if (GUILayout.Button("生成常量"))
                {
                    GenerateResourcesConst(rootNs, constNs, autoDir);
                }

                break;

                #endregion


                #region ResourceManagerType.AssetBundle

            case ResourceManagerType.AssetBundle:

                var newestVersion = PlayerPrefs.GetString(VersionDefine.PrefKey_LocalVersion, "0.0");

                if (GUILayout.Button("显示本地版本"))
                {
                    var versionData = PlayerPrefs.GetString(newestVersion);
                    Debug.Log("本地版本号:" + newestVersion + "\n版本信息:" + versionData);
                }

                EditorGUI.BeginChangeCheck();
                newestVersion = EditorGUILayout.DelayedTextField("本地版本", newestVersion);
                if (EditorGUI.EndChangeCheck())
                {
                    PlayerPrefs.SetString(VersionDefine.PrefKey_LocalVersion, newestVersion);
                }

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("打包目录", assetToBundleDir);
                if (GUILayout.Button("设置要打包的目录"))
                {
                    assetToBundleDir = EditorUtility.OpenFolderPanel("选择需要打包的目录", Application.dataPath, "");
                }

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("输出目录", outputDir);
                if (GUILayout.Button("设置输出目录"))
                {
                    outputDir = EditorUtility.OpenFolderPanel("选择输出目录", Application.dataPath, "");
                }

                EditorGUILayout.Space();
                assetBundleOptions =
                    (BuildAssetBundleOptions)EditorGUILayout.EnumFlagsField("打包选项", assetBundleOptions);

                buildTarget    = (BuildTarget)EditorGUILayout.EnumPopup("目标平台", buildTarget);
                clearOutputDir = EditorGUILayout.Toggle("清空生成目录", clearOutputDir);
                EditorGUILayout.Space();

                useForRuntime = EditorGUILayout.Foldout(useForRuntime, "使用用于生成运行时直接使用的AB包");
                if (useForRuntime)
                {
                    EditorGUILayout.LabelField("生成HotUpdatePath.cs路径",
                                               Application.dataPath + "/" + rootNs + "/" + constNs + "/" + autoDir + "/HotUpdatePath.cs");
                    useWeb = EditorGUILayout.Toggle("是否使用网络", useWeb);
                    EditorGUILayout.LabelField("游戏自身AB包名字", streamingAbName);

                    EditorGUILayout.Space();
                    if (GUILayout.Button("重新生成常量类【会覆盖】"))
                    {
                        if (!outputDir.Contains(Application.streamingAssetsPath))
                        {
                            Debug.LogError("运行时使用的AB包必须在StreamingAssets目录下");
                            return;
                        }

                        if (assetBundleNames.Count == 0)
                        {
                            Debug.LogError("AB包数组未空");
                            return;
                        }

                        CreatePathDataClass(rootNs, constNs, autoDir, assetBundleNames);
                        AssetDatabase.Refresh();
                        Debug.Log("生成完成");
                    }
                }


                if (GUILayout.Button("开始打包", GUILayout.Height(3 * EditorGUIUtility.singleLineHeight)))
                {
                    if (createPathDataClass)
                    {
                        if (!outputDir.Contains(Application.streamingAssetsPath))
                        {
                            Debug.LogError("运行时使用的AB包必须在StreamingAssets目录下");
                            return;
                        }
                    }

                    if (assetBundleNames.Count != 0)
                    {
                        assetBundleNames.Clear();
                    }
                    if (!Directory.Exists(assetToBundleDir))
                    {
                        Debug.LogError("打包目录设置异常");
                        return;
                    }

                    if (!Directory.Exists(outputDir))
                    {
                        Debug.LogError("输出目录设置异常");
                        return;
                    }

                    if (clearOutputDir)
                    {
                        if (Directory.Exists(outputDir))
                        {
                            //获取指定路径下所有文件夹
                            string[] folderPaths = Directory.GetDirectories(outputDir);

                            foreach (string folderPath in folderPaths)
                            {
                                Directory.Delete(folderPath, true);
                            }
                            //获取指定路径下所有文件
                            string[] filePaths = Directory.GetFiles(outputDir);

                            foreach (string filePath in filePaths)
                            {
                                File.Delete(filePath);
                            }
                        }
                    }

                    var builds = new List <AssetBundleBuild>();
                    foreach (var dirPath in System.IO.Directory.GetDirectories(assetToBundleDir))
                    {
                        var dirName    = new DirectoryInfo(dirPath).Name;
                        var paths      = new List <string>();
                        var assetNames = new List <string>();
                        FileUtil.SearchDirectory(dirPath,
                                                 fileInfo =>
                        {
                            if (fileInfo.Name.EndsWith(".meta"))
                            {
                                return;
                            }
                            var pureName = Path.GetFileNameWithoutExtension(fileInfo.FullName);
                            assetNames.Add(pureName);
                            var fileLoadPath = fileInfo.FullName.Replace("\\", "/")
                                               .Replace(Application.dataPath, "Assets");
                            var ai             = AssetImporter.GetAtPath(fileLoadPath);
                            ai.assetBundleName = dirName;
                            paths.Add(fileLoadPath);
                        }, true);

                        assetBundleNames.Add(dirName);
                        FileUtil.CreateConstClassByDictionary(
                            dirName + "Name",
                            Application.dataPath + "/" + rootNs + "/" + constNs,
                            rootNs + "." + constNs,
                            assetNames.ToDictionary(name => name));
                        builds.Add(new AssetBundleBuild
                        {
                            assetNames      = paths.ToArray(),
                            assetBundleName = dirName
                        });
                    }

                    if (createPathDataClass)
                    {
                        CreatePathDataClass(rootNs, constNs, autoDir, assetBundleNames);
                    }


                    BuildPipeline.BuildAssetBundles(outputDir, builds.ToArray(), assetBundleOptions, buildTarget);
                    AssetDatabase.Refresh();
                    Debug.Log("打包完成");
                }

                break;

                #endregion
            }
        }
 /// <summary>
 /// <para>Build all AssetBundles specified in the editor.</para>
 /// </summary>
 /// <param name="outputPath">Output path for the AssetBundles.</param>
 /// <param name="assetBundleOptions">AssetBundle building options.</param>
 /// <param name="targetPlatform">Chosen target build platform.</param>
 /// <returns>
 /// <para>The manifest listing all AssetBundles included in this build.</para>
 /// </returns>
 public static AssetBundleManifest BuildAssetBundles(string outputPath, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
 {
     if (!Directory.Exists(outputPath))
     {
         throw new ArgumentException("The output path \"" + outputPath + "\" doesn't exist");
     }
     return BuildAssetBundlesInternal(outputPath, assetBundleOptions, targetPlatform);
 }
Exemple #46
0
        public static bool BuildAssetBundle(UnityEngine.Object mainAsset, UnityEngine.Object[] assets, string pathName, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
        {
            uint crc;

            return(BuildAssetBundle(mainAsset, assets, pathName, out crc, assetBundleOptions, targetPlatform));
        }
 private static extern AssetBundleManifest BuildAssetBundlesWithInfoInternal(string outputPath, AssetBundleBuild[] builds, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform);
    static void ExportSingleAssetTextureDependenciesCorssReference(string path, BuildAssetBundleOptions options, BuildTarget buildTarget)
    {
        Object obj = AssetDatabase.LoadMainAssetAtPath(path);
        string mainPath = path;
        string name = "";// obj.name;
        Object[] denpendencies = EditorUtility.CollectDependencies(new Object[] { obj });
        bool haveTexture = false, haveGameObject = false;
        BuildPipeline.PushAssetDependencies();
        string paths = "", split = "";
        foreach (Object obj1 in denpendencies)
        {
            if (obj1 is UnityEngine.Texture)//|| obj1 is UnityEditor.MonoScript
            {
                path = AssetDatabase.GetAssetPath(obj1);
                name = obj1.name + "_.texture";
                name = name.Replace(" ", "_");
                BuildPipeline.BuildAssetBundle(AssetDatabase.LoadMainAssetAtPath(path), null, getOutPutPath(buildTarget) + "/" + name, optionsDependency, buildTarget);//| | BuildAssetBundleOptions.UncompressedAssetBundle
#if UNITY_EDITOR
                Debug.Log("dependencies Texture:" + obj1.name + ",type=" + obj1.GetType() + "rename " + obj1.name);
#endif
                paths += split + "AssetBundles/" + buildTarget.ToString() + "/" + name;
                split = ",";
                haveTexture = true;
            }
        }

        if (haveTexture) BuildPipeline.PushAssetDependencies();
        foreach (Object obj1 in denpendencies)
        {
            if (obj1 is UnityEngine.GameObject)
            {
                path = AssetDatabase.GetAssetPath(obj1);
                if (path != mainPath)
                {
                    //Debug.Log("path :"+path);
                    haveGameObject = true;
                    name = obj1.name + "." + suffix;
                    name = name.Replace(" ", "_");
                    BuildPipeline.BuildAssetBundle(AssetDatabase.LoadMainAssetAtPath(path), null, getOutPutPath(buildTarget) + "/" + name, options, buildTarget);

                    paths += split + "AssetBundles/" + buildTarget.ToString() + "/" + name;
                    split = ",";
#if UNITY_EDITOR
                    Debug.Log("dependencies GameObject:" + obj1.name + ",type=" + obj1.GetType() + "rename " + obj1.name);
#endif
                }
            }
        }

        name = "/" + obj.name + "." + suffix;

        if (haveGameObject) BuildPipeline.PushAssetDependencies();
        if (paths != "")
        {
            GameObject game = new GameObject();
            CDependencies denp = game.AddComponent<CDependencies>();
            denp.paths = paths;
            GameObject c_dependen = PrefabUtility.CreatePrefab("Assets/CObjDependencies.prefab", game);

            BuildPipeline.BuildAssetBundle(obj, new Object[] { c_dependen }, getOutPutPath(buildTarget) + name, options, buildTarget);
#if UNITY_EDITOR
            Debug.Log(name + " has export Contains :" + paths);
#endif
            GameObject.DestroyImmediate(game);
        }
        else
        {
            BuildPipeline.BuildAssetBundle(obj, null, getOutPutPath(buildTarget) + name, options, buildTarget);
            Debug.Log(name + " has export");

        }

        if (haveGameObject) BuildPipeline.PopAssetDependencies();
        if (haveTexture) BuildPipeline.PopAssetDependencies();
        BuildPipeline.PopAssetDependencies();

    }
 public static bool BuildAssetBundle(Object mainAsset, Object[] assets, string pathName, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
 {
     uint num;
     return BuildAssetBundle(mainAsset, assets, pathName, out num, assetBundleOptions, targetPlatform);
 }
 static public void BuildAB(Object main, Object[] assets, string pathName, BuildAssetBundleOptions bbo)
 {
     BuildPipeline.BuildAssetBundle(main, assets, pathName, bbo, target);
 }
 public static bool BuildAssetBundleExplicitAssetNames(UnityEngine.Object[] assets, string[] assetNames, string pathName, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
 {
   uint crc;
   return BuildPipeline.BuildAssetBundleExplicitAssetNames(assets, assetNames, pathName, out crc, assetBundleOptions, targetPlatform);
 }
Exemple #52
0
 public static bool BuildAssetBundle(UnityEngine.Object mainAsset, UnityEngine.Object[] assets, string pathName, BuildAssetBundleOptions assetBundleOptions)
 {
     BuildTarget webPlayer = BuildTarget.WebPlayer;
     return BuildAssetBundle(mainAsset, assets, pathName, assetBundleOptions, webPlayer);
 }
    static void ExportSingleAssetGameObjectDependenciesCorssReference(string path, BuildAssetBundleOptions options, BuildTarget buildTarget)
    {
        Object obj = AssetDatabase.LoadMainAssetAtPath(path);
        string mainPath = path;
        string name = "";// obj.name;
        Object[] denpendencies = EditorUtility.CollectDependencies(new Object[] { obj });
        bool haveGameObject = false;
        BuildPipeline.PushAssetDependencies();

        string paths = "", split = "";
        foreach (Object obj1 in denpendencies)
        {
            if (obj1 is UnityEngine.GameObject || obj1 is UnityEngine.Font)
            {
                path = AssetDatabase.GetAssetPath(obj1);
                if (path != mainPath)
                {
                    //						Debug.Log("path :"+path);
                    name = obj1.name + "." + suffix;
                    name = name.Replace(" ", "_");//
                    string tarName = getOutPutPath(buildTarget) + "/" + name;
                    BuildPipeline.BuildAssetBundle(obj1, null, tarName, optionsDependency, buildTarget);
                    paths += split + buildTarget.ToString() + "/" + name;
                    split = ",";
                    haveGameObject = true;
#if UNITY_EDITOR
                    Debug.Log("dependencies :" + obj1.name + ",type=" + obj1.GetType() + "," + path);
#endif
                    AssetDatabase.Refresh();
                    System.Threading.Thread.Sleep(500);
                }
            }
        }

        name = "/" + obj.name + "." + suffix;

        if (haveGameObject) BuildPipeline.PushAssetDependencies();
        if (paths != "")
        {
            //#if UNITY_5
            CDependenciesScript denpend = ScriptableObject.CreateInstance<CDependenciesScript>();
            //denpend.name = Common.DEPENDENCIES_OBJECT_NAME;
            denpend.paths = paths;
            string pathAsset = "Assets/" + Common.DEPENDENCIES_OBJECT_NAME + ".asset";
            AssetDatabase.CreateAsset(denpend, pathAsset);
            Object o = AssetDatabase.LoadAssetAtPath(pathAsset, typeof(CDependenciesScript));
            o.name = Common.DEPENDENCIES_OBJECT_NAME;
            BuildPipeline.BuildAssetBundle(obj, new Object[] { o }, getOutPutPath(buildTarget) + name, options, buildTarget);
            //#else
            //                            GameObject game=new GameObject();
            //                            game.name = Common.DEPENDENCIES_OBJECT_NAME;
            //                            CDependencies denp=game.AddComponent<CDependencies>();
            //                            denp.paths=paths;
            //                            GameObject c_dependen = PrefabUtility.CreatePrefab("Assets/" + Common.DEPENDENCIES_OBJECT_NAME + ".prefab", game);
            //                            BuildPipeline.BuildAssetBundle(obj ,new Object[]{c_dependen}, getOutPutPath(buildTarget) + name, options,buildTarget);
            //                            GameObject.DestroyImmediate(game);

            //#endif
#if UNITY_EDITOR
            Debug.Log(name + " has export Contains :" + paths);
#endif
        }
        else
        {
            BuildPipeline.BuildAssetBundle(obj, null, getOutPutPath(buildTarget) + name, options, buildTarget);
            Debug.Log(name + " has export");
        }

        if (haveGameObject) BuildPipeline.PopAssetDependencies();
        BuildPipeline.PopAssetDependencies();

    }
 public static bool BuildAssetBundle(UnityEngine.Object mainAsset, UnityEngine.Object[] assets, string pathName, out uint crc, BuildAssetBundleOptions assetBundleOptions)
 {
   BuildTarget targetPlatform = BuildTarget.WebPlayer;
   return BuildPipeline.BuildAssetBundle(mainAsset, assets, pathName, out crc, assetBundleOptions, targetPlatform);
 }
Exemple #55
0
        public static bool BuildAssetBundleExplicitAssetNames(UnityEngine.Object[] assets, string[] assetNames, string pathName, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
        {
            uint crc;

            return(BuildAssetBundleExplicitAssetNames(assets, assetNames, pathName, out crc, assetBundleOptions, targetPlatform));
        }
	static public void BuildABs(string[] assets, string outPath,string abName, BuildAssetBundleOptions bbo)
	{
		AssetBundleBuild[] bab = new AssetBundleBuild[1];
		bab[0].assetBundleName = abName;//打包的资源包名称 随便命名
		bab[0].assetNames = assets;

		BuildPipeline.BuildAssetBundles (outPath, bab, bbo, target);
//		BuildPipeline.BuildAssetBundle(main, assets, pathName, bbo, target);

	}
    IEnumerator Package()
    {
        //自动保存设置文件
        CreatPackageFile();

        //自动增加小版本号
        smallVersion++;
        CreatVersionFile();

        relyBuildOption = BuildAssetBundleOptions.DeterministicAssetBundle //每次二进制一致
               | BuildAssetBundleOptions.CollectDependencies;   //收集依赖
                                                                //| BuildAssetBundleOptions.CompleteAssets;      //完整资源
                                                                //| BuildAssetBundleOptions.UncompressedAssetBundle //不压缩

        BuildPipeline.PushAssetDependencies();

        float sumCount = relyPackages.Count + bundles.Count;
        float currentCount = 0;

        isPacking = true;

        ShowProgress(0, "删除旧资源");
        yield return 0;

        //删除streaming下所有旧资源
        if (Directory.Exists(Application.dataPath + "/StreamingAssets"))
        {
            FileTool.DeleteDirectory(Application.dataPath + "/StreamingAssets");
        }

        ShowProgress(0, "开始打包");
        yield return 0;

        //先打依赖包
        for (int i = 0; i < relyPackages.Count; i++)
        {
            PackageRelyPackage(relyPackages[i]);

            currentCount++;
            ShowProgress(currentCount / sumCount, "打包依赖包 第" + i + "个 共" + relyPackages.Count + "个");

            yield return 0;
        }

        //再打普通包
        for (int i = 0; i < bundles.Count; i++)
        {
            PackageBundle(bundles[i]);
            currentCount++;
            ShowProgress(currentCount / sumCount, "打包普通包 第" + i + "个 共" + bundles.Count + "个");

            yield return 0;
        }

        for (int i = 0; i < m_NoPackagekFile.Count; i++)
        {
            CopyFile(m_NoPackagekFile[i]);
        }

        EndProgress();

        BuildPipeline.PopAssetDependencies();

        AssetDatabase.Refresh();

        CreatBundelPackageConfig();
        Repaint();

        isPacking = false;
    }
Exemple #58
0
        public static bool BuildAssetBundleExplicitAssetNames(UnityEngine.Object[] assets, string[] assetNames, string pathName, out uint crc, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform)
        {
            BuildTargetGroup targetPlatformGroup = BuildPipeline.GetBuildTargetGroup(targetPlatform);

            return(BuildAssetBundleExplicitAssetNames(assets, assetNames, pathName, out crc, assetBundleOptions, targetPlatformGroup, targetPlatform));
        }
 static void BuildAllAssetBundles()
 {
     var options = new BuildAssetBundleOptions();
     BuildPipeline.BuildAssetBundles("asset_bundles", options, BuildTarget.StandaloneWindows64);
 }
Exemple #60
0
 // Builds an AssetBundle, with custom names for the assets.
 internal static bool BuildAssetBundleExplicitAssetNames(UnityEngine.Object[] assets, string[] assetNames, string pathName, out uint crc, BuildAssetBundleOptions assetBundleOptions, BuildTargetGroup targetPlatformGroup, BuildTarget targetPlatform)
 {
     crc = 0;
     try
     {
         return(BuildAssetBundleInternal(null, assets, assetNames, pathName, assetBundleOptions, targetPlatformGroup, targetPlatform, out crc));
     }
     catch (System.Exception exception)
     {
         LogBuildExceptionAndExit("BuildPipeline.BuildAssetBundleExplicitAssetNames", exception);
         return(false);
     }
 }