public static void BuildAssetResource(BuildTarget target) { string streamPath = SysDefine.GetAssetsTargetPathByPlatform(BuildTargetToPlatform(target)); Debug.Log(streamPath); if (Directory.Exists(streamPath)) { Directory.Delete(streamPath, true); } Directory.CreateDirectory(streamPath); AssetDatabase.Refresh(); AllInfo.Infos.Clear(); Maps.Clear(); foreach (var dir in Directory.GetDirectories(SysDefine.PATH_ASSETBUNDLE_LOCAL)) { string dirName = Path.GetFileName(dir); Debug.Log($"Handle {dirName}"); HandleBundles(dirName); } BuildPipeline.BuildAssetBundles(streamPath, Maps.ToArray(), BuildAssetBundleOptions.None, target); AssetDatabase.Refresh(); }
public static void BuildAssetInfo(BuildTarget target) { string streamPath = SysDefine.GetStreamingAssetsTargetPathByPlatform(BuildTargetToPlatform(target)); string path = SysDefine.GetAssetsTargetPathByPlatform(BuildTargetToPlatform(target)); if (Directory.Exists(streamPath)) { Directory.Delete(streamPath, true); } Directory.CreateDirectory(streamPath); AllBundleInfo AllInfos = new AllBundleInfo(); string[] files = Directory.GetFiles(path); foreach (var file in files) { //if (Path.GetFileName(file)!= "AssetBundles.manifest" && Path.GetExtension(file) == ".manifest") continue; var info = GetInfo(file); AllInfos.Infos.Add(info.Name, info); File.Copy(file, Path.Combine(streamPath, info.Name + "@" + info.MD5)); } string json = JsonConvert.SerializeObject(AllInfos, Formatting.Indented); if (File.Exists(streamPath + "/" + AllBundleInfo.Name)) { File.Delete(streamPath + "/" + AllBundleInfo.Name); } File.WriteAllText(streamPath + "/" + AllBundleInfo.Name, json); }