2

我有 Unity 2018.1.9f2,我下载了 Unity ml 代理并将文件夹添加到我的统一项目中。但是当我尝试运行“3D Ball”场景时,我在控制台中收到此错误:

Assets/ml-agents-master/UnitySDK/Assets/ML-Agents/Scripts/Brain.cs(79,25): error CS1644: Feature null propagating operator' 不能使用,因为它不是 C# 4.0 语言规范的一部分。当我双击它时,它会打开 VS 并brainBatcher?.SendBrainInfo(name, agentInfos);带有下划线。当我将鼠标悬停在它说的代码上时Feature 'null propagating operator' is not available in C# 4. Please use language version 6 or greater.

我试图遵循另一个类似问题的答案:Unity Visual Studio C# version synchronization。所以我使用了 unity-c-5.0-and-6.0-integration 并且没有显示该错误,但我得到了 150 多个其他错误。

任何帮助都感激不尽。

4

2 回答 2

12

确保您的播放器设置/脚本运行时版本设置为 .NET 4.x 而不是 .NET 3.5

脚本运行时版本

于 2019-02-04T15:29:36.790 回答
1

Why not just remove the ?

In my case, the following change fixes the build even using .net 3.5 framework


Action<DeleteObjectsResponse, string> result;

// Change:

//result?.Invoke(null, responseObj.Exception.ToString());

// To:

if (result != null)
   result.Invoke(null, responseObj.Exception.ToString());
于 2019-06-25T05:54:37.640 回答