static IEnumerator DownLoadFile(string url) { var fileName = Path.GetFileName(url); var zipSavePath = Path.Combine(Application.dataPath, "../" + fileName); if (File.Exists(zipSavePath)) { File.Delete(zipSavePath); } var stream = new FileStream(zipSavePath, FileMode.OpenOrCreate); var task = new HttpTask() { stream = stream, url = url }; HttpUtil.AddTask(task); while (task.progress < 1) { progress = 0.8f * task.progress; if (ShowProgress( $"下载文件 {fileName} {task.downloadSize / 1024}/{task.totalSize / 1024}KB", progress)) { yield break; } yield return(null); } if (isStop) { yield break; } try { ShowProgress("解压中", progress); var decompressDir = Path.Combine(Application.dataPath, "../" + Path.GetFileNameWithoutExtension(url)); if (Directory.Exists(decompressDir)) { Directory.Delete(decompressDir, true); } Decompress(zipSavePath, decompressDir); File.Delete(zipSavePath); progress = 0.9f; ShowProgress("完成", progress); } catch (Exception e) { Debug.LogError("Failed !" + e); } finally { EditorUtility.ClearProgressBar(); } }