| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEditor; |
| | | using System.IO; |
| | | |
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | | using UnityEditor;
|
| | | using System.IO;
|
| | |
|
| | | public class AssetBundleBuildExtersion
|
| | | {
|
| | | public static void Build(string output, string category, BuildAssetBundleOptions bundleOption, BuildTarget buildTarget)
|
| | | public static void Build(string output, string category, BuildAssetBundleOptions bundleOption, BuildTarget buildTarget, bool rebuild = true)
|
| | | {
|
| | | var assetBundles = AssetDatabase.GetAllAssetBundleNames();
|
| | | var targetAssetBundles = new List<string>();
|
| | |
| | | var manifest = StringUtility.Contact(output, Path.AltDirectorySeparatorChar, GetMainFestFileName(buildTarget), ".manifest");
|
| | | var manifestRename = StringUtility.Contact(output, Path.AltDirectorySeparatorChar, category, "_assetbundle.manifest");
|
| | |
|
| | | if (Directory.Exists(rootPath))
|
| | | {
|
| | | if (rebuild && Directory.Exists(rootPath))
|
| | | Directory.Delete(rootPath, true);
|
| | | }
|
| | |
|
| | | Directory.CreateDirectory(rootPath);
|
| | | // if (!Directory.Exists(rootPath))
|
| | | // Directory.CreateDirectory(rootPath);
|
| | |
|
| | | if (File.Exists(mainFileRename))
|
| | | {
|
| | |
| | | default:
|
| | | return string.Empty;
|
| | | }
|
| | | } |
| | | |
| | | [MenuItem("Assets/BuildAssetBundle ( Test )")] |
| | | }
|
| | |
|
| | | [MenuItem("Assets/BuildAssetBundle ( Test )")]
|
| | | public static void BuildTest()
|
| | | {
|
| | | if (Selection.activeObject != null) |
| | | { |
| | | if (Selection.activeObject != null)
|
| | | {
|
| | | var path = AssetDatabase.GetAssetPath(Selection.activeObject);
|
| | | var importer = AssetImporter.GetAtPath(path); |
| | | |
| | | if (importer != null) |
| | | { |
| | | var ab = importer.assetBundleName; |
| | | if (!string.IsNullOrEmpty(ab)) |
| | | var importer = AssetImporter.GetAtPath(path);
|
| | |
|
| | | if (importer != null)
|
| | | {
|
| | | var ab = importer.assetBundleName;
|
| | | if (!string.IsNullOrEmpty(ab))
|
| | | {
|
| | |
|
| | | var assetBundles = AssetDatabase.GetAllAssetBundleNames();
|
| | |
| | | | BuildAssetBundleOptions.DeterministicAssetBundle;
|
| | |
|
| | | var dirctory = Application.dataPath + "/BundleTest";
|
| | | if (!Directory.Exists(dirctory)) |
| | | { |
| | | Directory.CreateDirectory(dirctory); |
| | | if (!Directory.Exists(dirctory))
|
| | | {
|
| | | Directory.CreateDirectory(dirctory);
|
| | | }
|
| | | BuildPipeline.BuildAssetBundles(dirctory, assets.ToArray(), opt, BuildTarget.Android); |
| | | } |
| | | } |
| | | |
| | | BuildPipeline.BuildAssetBundles(dirctory, assets.ToArray(), opt, BuildTarget.Android);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | } |
| | | |
| | | } |
| | | }
|
| | |
|
| | | }
|