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

【ML-Agents】ML-Agents示例项目导入unity报错解决

最近在跑ML-Agents的示例代码,无奈往unity中导入项目后,就出现报错。本文简要描述了各个报错的解决方法。

文章目录

  • 一、error CS0234: The type or namespace name 'InputSystem' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)
  • 二、error CS0234: The type or namespace name 'Recorder' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
  • 三、error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)


一、error CS0234: The type or namespace name ‘InputSystem’ does not exist in the namespace ‘UnityEngine’ (are you missing an assembly reference?)

在这里插入图片描述
关于这个bug,github中有一个issue专门提到:https://github.com/Unity-Technologies/ml-agents/issues/5752

文中有人提到,可以通过删除 PushBlockWithInput 文件夹,或者通过安装指定版本 release-19 的 com.unity.ml-agents 和 com.unity.ml-agents.extensions 来解决。但似乎都不能从根本上解决问题。

有人提到:

I could fix the same Errors with the new Input Sytem: []https://docs.unity3d.com/Packages/com.unity.inputsystem@1.0/manual/Installation.html

此方法可行。打开上述链接,按照提示在unity中的package manager中安装 Input System 包即可。

二、error CS0234: The type or namespace name ‘Recorder’ does not exist in the namespace ‘UnityEditor’ (are you missing an assembly reference?)

UnityEditor.Recorder 是 Unity 的 录制工具 API,属于独立模块。报错的原因可能是未安装 Recorder 包。

解决方法:

  • 打开 Package Manager (Window > Package Manager)
  • 点击左上角 “+” > Add package by name…
  • 输入包名:com.unity.recorder
  • 安装 Recorder 包即可

三、error CS0246: The type or namespace name ‘Newtonsoft’ could not be found (are you missing a using directive or an assembly reference?)

Unity 项目中缺少 Newtonsoft.Json 库(也称为 Json.NET),安装一下就好。

解决方法:

  • 打开 Unity Editor
  • 菜单栏选择 Window > Package Manager
  • 点击左上角的 “+” 按钮
  • 选择 “Add package from git URL…”
  • 输入:com.unity.nuget.newtonsoft-json
  • 点击 Add

相关文章:

  • 关于汇编语言与程序设计——单总线温度采集与显示的应用
  • 解决 SQL Server 2008 导入 Excel 表卡在“正在初始化数据流”问题
  • 前端取经路——现代API探索:沙僧的通灵法术
  • Axure疑难杂症:统计分析页面引入Echarts示例动态效果
  • Dia浏览器:AI驱动浏览网页,究竟怎么样?(含注册申请体验流程)
  • VUE CLI - 使用VUE脚手架创建前端项目工程
  • Linux——MySQL约束与查询
  • AI 助力,轻松进行双语学术论文翻译!
  • null 的安全操作 vs 危险操作
  • 第7次课 栈A
  • VScode密钥(公钥,私钥)实现免密登录【很细,很全,附带一些没免密登录成功的一些解决方法】
  • [架构之美]Spring Boot集成MyBatis-Plus高效开发(十七)
  • ODA服务器计算节点本地硬盘状态异常的处理
  • [架构之美]Windows系统安装MySQL 8.0详细图文教程(十八)
  • [手写系列]Go手写db — — 完整教程
  • Linux `uptime` 指令详解与系统监控指南
  • One Data理论
  • Docker Desktop安装在其他盘
  • 材料创新与工艺升级——猎板PCB引领高频阻抗板制造革命
  • 第3.2.3节 Android动态调用链路的获取
  • 傅利叶提出下个十年战略,CEO顾捷:机器人要有温度,要用实际价值来定义形态
  • 优秀“博主”在上海杨浦购房最高补贴200万元,有何条件?
  • 安徽亳州涡阳县司法局党组书记刘兴连落马
  • 溢价26.3%!保利置业42.4亿元竞得上海杨浦宅地,楼板价80199元/平方米
  • 复旦大学文科杰出教授裘锡圭逝世,享年90岁
  • 复旦设立新文科发展基金,校友曹国伟、王长田联合捐赠1亿元