【发布时间】:2015-09-20 21:52:54
【问题描述】:
在通过 Unity3D 创建 iOS 64 支持的过程中,我遇到了一个奇怪的情况, yield return www 调用阻塞了设备上的主线程。
我尝试了 Unity 版本 4.6.5、4.6.6 和 5.1.0,并在 WWW 类中遇到了同样的问题。 我也试过 xCode 版本 6.3.0、6.3.1、6.3.2。
下面是我正在使用的代码sn-p
private IEnumerator StartDownload(string url, string path)
{
WWW www = new WWW(url);
yield return www; //blocking main thread
if (string.IsNullOrEmpty(www.error))
{
Debug.Log("File Download Complete");
}
else
{
Debug.Log("Error in downloading file, Error: " + www.error);
}
}
【问题讨论】: