当前位置: 首页 > news >正文

unity UnityWebRequest 的request.downloadHandler 空应用

unity UnityWebRequest 的request.downloadHandler 空应用

private IEnumerator Test_Get()
{UnityWebRequest request = new UnityWebRequest(tmp_getURL, "GET");yield return request.SendWebRequest();if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError){Debug.LogError($"Post Error: {request.error}");}else{Debug.Log($"Post Success: {request.downloadHandler.text}");}
}

解决办法

创建一个 DownloadHandlerBuffer 对象。

private IEnumerator Test_Get()
{UnityWebRequest request = UnityWebRequest.Get(tmp_getURL);request.downloadHandler = new DownloadHandlerBuffer(); // 确保有下载处理器yield return request.SendWebRequest();if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError){Debug.LogError($"Get Error: {request.error}");}else{Debug.Log($"Get Success: {request.downloadHandler.text}");}
}
http://www.lryc.cn/news/443327.html

相关文章:

  • 使用 UWA Gears 定位游戏内存问题
  • OpenRestry(一个Nginx集成工具)的安装与使用
  • linux操作系统的基本命令
  • 通过UV快速计算品牌独立站网络流量
  • 使用Kong开源API网关的保姆级教程
  • 浅谈Spring Cloud:认识微服务
  • mac命令行分卷压缩与合并
  • 在 Linux (aarch64) 编译 OpenJDK 8
  • 如何有效检测住宅IP真伪?
  • springboot acuturator
  • 什么是SaaS软件?有哪些常用的SaaS软件?
  • QT Layout布局,隐藏其中的某些部件后,不影响原来的布局
  • WPF自定义Dialog模板,内容用不同的Page填充
  • [数据集][目标检测]智慧养殖场肉鸡健康状态检测数据集VOC+YOLO格式4657张2类别
  • Linux 应用安全
  • 优化内存工具 | RAM Saver Pro v24.9 便携版
  • 后台数据管理系统 - 项目架构设计-Vue3+axios+Element-plus(0920)
  • 众数信科AI智能体政务服务解决方案——寻知智能笔录系统
  • OpenCV特征检测(4)检测图像中的角点函数cornerHarris()的使用
  • Apache Doris 2.1.6 版本正式发布
  • 一些常用的 Docker 命令
  • 【机器学习】--- 自然语言推理(NLI)
  • 大话C++:第11篇 类的定义与封装
  • 六种主流ETL工具的比较与Kettle的实践练习指南--MySQL、hive、hdfs等之间的数据迁移
  • 一天一道算法题day07
  • 电机学习-有感BLDC开环控制(六步换相)
  • 《深度学习》PyTorch框架 优化器、激活函数讲解
  • Linux:进程(四)
  • CTC loss 博客转载
  • TryHackMe 第3天 | Pre Security (中)