public static bool CompressABToStreamingAssetDir() { Debug.Log("正在压缩bundle到StreamingAssets目录中..."); string from = PackagePath.GetOutAssetBundleDir(); if (!Directory.Exists(from)) { Debug.LogError("can not find ab dir:path =" + from); return(false); } string toDir = PackagePath.GetStreamingAssetABDir(); if (!Directory.Exists(toDir)) { Directory.CreateDirectory(toDir); } string to = PackagePath.GetStreamingAssetABZipFilePath(); try { //压缩时,会将/../这些东西打到压缩文件,导致解压时会有问题(拿文件相对目录时) from = new DirectoryInfo(from).FullName; //LaunchCompress.CompressDirExcept(from, to, ".manifest"); } catch (Exception e) { Debug.LogError("compress bundle fail!msg:" + e.Message + ",StackTrace:" + e.StackTrace); return(false); } AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); return(true); }
public static bool CopyABToStreamingAssetDir() { string from = PackagePath.GetOutAssetBundleDir(); if (!Directory.Exists(from)) { Debug.LogError("can not find ab dir:path =" + from); return(false); } string to = PackagePath.GetStreamingAssetABDir(); EditorFileOperate.CopyTo(from, to, ".manifest"); AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); return(true); }