public static void CreateAllAssetBundles() { ExportAB.CreateAllAssetBundles2(); Debug.Log("===> 资源打包完成"); ExportConfig.Export(); Debug.Log("===> 配置打包完成"); }
static void ExportResource() { // 打包的 List <Object> luaList = new List <Object>(); // 要删除的 List <string> copyList = new List <string>(); // 获取文件 List <FileInfo> fileList = new List <FileInfo>(); DirectoryInfo folder = new DirectoryInfo(m_luaScriptPath); GetAllFile(folder, "*.txt", ref fileList); GetAllFile(folder, "*.bytes", ref fileList); //foreach (FileInfo file in fileList) //{ // // 通过资源获取路径 // string prefabPath = file.FullName; // // 改名,复制 // string copyFile = Application.dataPath + "/Resource/config/lua/" + file.Name + ".txt"; // string strNewPath = Path.GetDirectoryName(copyFile); // strNewPath = strNewPath.Replace("\\", "/"); // Directory.CreateDirectory(strNewPath); // File.Copy(prefabPath, copyFile, true); // copyList.Add(copyFile); // //Debug.Log("增加lua文件:" + prefabPath); //} AssetDatabase.Refresh(); // 打包 foreach (FileInfo file in fileList) { string assetPath = file.FullName.Substring(file.FullName.IndexOf("Assets")); AssetImporter importer = AssetImporter.GetAtPath(assetPath); importer.assetBundleName = "config/alllua"; //Debug.Log("成功设置lua脚本ab名:" + assetPath); } // 拿到该文件的文件夹路径, 创建文件夹路径 //string strNewFile = m_luaExportPath; //string strNewPath = Path.GetDirectoryName(strNewFile); //strNewPath = strNewPath.Replace("\\", "/"); //Directory.CreateDirectory(strNewPath); // 开始将选择的资源打包 //BuildPipeline.BuildAssetBundle(null, luaList.ToArray(), strNewFile, // BuildAssetBundleOptions.CompleteAssets, // ExportDefine.m_buildTarget); Debug.Log("打包成功:config/alllua"); //foreach (string file in copyList) //{ // File.Delete(file); //} copyList.Clear(); AssetDatabase.Refresh(); ExportAB.CreateAllAssetBundles(); }