IEnumerator DownloadMLModel() { string url = "http://www.setsuodu.com/download/MobileNet.mlmodel"; //WWW不支持https string filePath = Application.persistentDataPath + "/MobileNet.mlmodel"; if (!File.Exists(filePath)) { Debug.Log("开始下载MLModel..."); WWW www = new WWW(url); while (!www.isDone) { Debug.Log(www.progress * 100 + "%"); yield return(null); } yield return(www); if (!string.IsNullOrEmpty(www.error)) { Debug.Log(www.error); yield break; } if (www.isDone) { byte[] bytes = www.bytes; FileStream fileStream = File.Create(filePath); fileStream.Write(bytes, 0, bytes.Length); fileStream.Close(); } } Debug.Log("下载完成:" + filePath); // /Users/xueyutao/Library/Application Support/setsuodu/CoreMLPlugin/MobileNet.mlmodel OSHookBridge.LoadMLModel(filePath); }