using UnityEditor; using UnityEngine; public class BuildAssetBundle { [MenuItem("AssetBundle/BuildSingle")] static void BuildSigle() { BuildPipeline.BuildAssetBundles(Application.dataPath, BuildAssetBundleOptions.None,BuildTarget.StandaloneWindows); AssetDatabase.Refresh(); } [MenuItem("AssetBundle/BuildCollections")] static void BuildCollections() { AssetBundleBuild[] buildMap = new AssetBundleBuild[1]; buildMap[0].assetBundleName = "abc"; object[] selects = Selection.GetFiltered(typeof(Object), SelectionMode.Assets); string[] abcBundle = new string[selects.Length]; for(int i=0;i<selects.Length;i++) { abcBundle[i] = AssetDatabase.GetAssetPath((GameObject)selects[i]); } buildMap[0].assetNames = abcBundle; BuildPipeline.BuildAssetBundles(Application.dataPath+"/Test",BuildAssetBundleOptions.None,BuildTarget.StandaloneWindows); AssetDatabase.Refresh(); } }