private static void MoveAssetBundleAtEveryBuild(List <string> paths, AssetBundleBuildSetting dirSetting) { var bundleIds = paths.Select(p => Path.GetFileNameWithoutExtension(p)?.ToLower()) .ToList(); var locApp = ProjectInfoDati.GetActualInstance(); var assetBundleOutPaths = IOUtility.GetPathDictionary(locApp.AssetBundleBuildDir, s => !s.EndsWith(".manifest")); var targetDirId = IOUtility.GetLastDir(dirSetting.Dir); var moveDir = locApp.AssetBundleBuildDir + targetDirId; moveDir = moveDir.EnsureDirEnd(); foreach (var bundleId in bundleIds) { var sourcePath = assetBundleOutPaths[bundleId]; var targetPath = moveDir + bundleId + ASSETBUNDLE_SHORT_SUFFIX; IOUtility.Move(sourcePath, targetPath); } }
private void AddNode() { if (BuildType != AssetBundleBuildType.BuildAtList) { UnityEditorUtility.DisplayError("当前目录的打包方式不是BuildAtList,请先修改打包方式!"); return; } var fileIds = GetFileIds(); foreach (var node in BundleNodes) { foreach (var file in node.FileIds) { fileIds.Remove(file); } } AssetBundleBuildBaseNode newBaseNode = null; var dirId = IOUtility.GetLastDir(Dir); var newBundleId = dirId + "_" + BundleNodes.Count; if (BundleNodes.Find(n => n.BundleId == newBundleId) != null) { UnityEditorUtility.DisplayError($"目标Bundle名已存在!"); newBaseNode = new AssetBundleBuildBaseNode(); } else { newBaseNode = new AssetBundleBuildBaseNode { BundleId = newBundleId }; } newBaseNode.AddFiles(fileIds); BundleNodes.Add(newBaseNode); }