我正在使用 Unity 2019,并制作了一个脚本,该脚本使用“UnityWebRequest”从 PC 加载纹理。
using (UnityWebRequest uwr = UnityWebRequestTexture.GetTexture(finalPath))
{
yield return uwr.SendWebRequest();
if (uwr.isNetworkError || uwr.isHttpError)
{
Debug.Log(uwr.error);
}
else
{
// Get downloaded asset bundle
horizImg.gameObject.SetActive(true);
horizImg.texture = DownloadHandlerTexture.GetContent(uwr);
}
}
如果 finalpath 名称中有空格或“+”,它运行良好,但如果“finalPath”同时包含(“+”和空格“),则返回此错误:
HTTP/1.1 404 未找到