Unity的UnityWebRequest如果设置了timeout,在超时后会有一个Curl error 28的报错,很是讨厌,强迫症患者可以用下面的办法过滤掉。文章来源:https://www.toymoban.com/news/detail-643662.html
async private void Start()
{
UnityWebRequest unityWeb;
unityWeb = new UnityWebRequest(url, "Get");
unityWeb.downloadHandler = new DownloadHandlerBuffer();
//unityWeb.timeout = 3;
var taskget = unityWeb.SendWebRequest();
await Task.Delay(3000);
if (unityWeb.result != UnityWebRequest.Result.Success)
{
Debug.LogWarning("Http获取远程文件失败: " + unityWeb.result.ToString() + " , Url:" + url);
loaderror = true;
}
unityWeb.Dispose();
}
核心思想就是不用timeout,直接3秒后就判断就是下载到了。文章来源地址https://www.toymoban.com/news/detail-643662.html
到了这里,关于Unity捕获Curl error 28的办法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!