private void Deploy(string targetPath) { try { var progressMAX = Assets.GetTargetBundles.Count; var progressDone = 0; void Progress() { EditorUtility.DisplayProgressBar("Compressing...", "Compressing and deploying zipmod", progressDone / (float)progressMAX); } Progress(); foreach (var targetName in Assets.GetTargetBundles) { var targetFolder = TempZipFolder(targetName); var targetModFileName = GetSplitTargetName(targetName); if (targetModFileName.IsNullOrEmpty()) { throw new Exception("Output file name cannot be empty."); } // Props to 2155X for giving me new multi-platform method! var from = targetFolder; var to = Path.Combine(targetPath, $"{targetModFileName}.zipmod").ToUnixPath(); if (File.Exists(to)) { File.Delete(to); } CompressUtils.CreateFromDirectory(from, to); if (CleanTempFolderAfterBuild) { Directory.Delete(from, true); } Debug.Log($"Successfully packaged mod {targetModFileName}.zipmod!"); progressDone++; Progress(); } } catch (Exception) { EditorUtility.ClearProgressBar(); throw; } }