错误 CS1644:无法使用功能“空传播运算符”,因为它不是 C# 4.0 语言规范的一部分
error CS1644: Feature `null propagating operator' cannot be used because it is not part of the C# 4.0 language specification
我有 Unity 2018.1.9f2,我下载了 Unity ml 代理并将该文件夹添加到我的 unity 项目中。但是当我尝试 运行 '3DBall' 场景时,我在控制台中收到此错误:
Assets/ml-agents-master/UnitySDK/Assets/ML-Agents/Scripts/Brain.cs(79,25):错误 CS1644:无法使用功能 null 传播运算符,因为它不是 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-c-5.0-and-6.0-integration 并且没有显示该错误,但我得到了 150 多个其他错误。
任何帮助将不胜感激。
确保您的播放器设置/脚本运行时版本设置为 .NET 4.x 而不是 .NET 3.5
为什么不直接删除 ?
就我而言,即使使用 .net 3.5 框架,以下更改也修复了构建
Action<DeleteObjectsResponse, string> result;
// Change:
//result?.Invoke(null, responseObj.Exception.ToString());
// To:
if (result != null)
result.Invoke(null, responseObj.Exception.ToString());
我有 Unity 2018.1.9f2,我下载了 Unity ml 代理并将该文件夹添加到我的 unity 项目中。但是当我尝试 运行 '3DBall' 场景时,我在控制台中收到此错误:
Assets/ml-agents-master/UnitySDK/Assets/ML-Agents/Scripts/Brain.cs(79,25):错误 CS1644:无法使用功能 null 传播运算符,因为它不是 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.
我试图遵循另一个类似问题的答案:
任何帮助将不胜感激。
确保您的播放器设置/脚本运行时版本设置为 .NET 4.x 而不是 .NET 3.5
为什么不直接删除 ?
就我而言,即使使用 .net 3.5 框架,以下更改也修复了构建
Action<DeleteObjectsResponse, string> result;
// Change:
//result?.Invoke(null, responseObj.Exception.ToString());
// To:
if (result != null)
result.Invoke(null, responseObj.Exception.ToString());