【发布时间】:2019-02-04 15:09:15
【问题描述】:
我有 Unity 2018.1.9f2,我下载了 Unity ml 代理并将文件夹添加到我的统一项目中。但是当我尝试运行“3Dball”场景时,我在控制台中收到了这个错误:
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 多个其他错误。
任何帮助将不胜感激。
【问题讨论】:
-
如果代码使用 C# 语法,例如
?.,那么确实需要更新的编译器,您已经尝试过;很可能“150 多个其他错误”只是缺少库/包引用,所以这里可能只是几个实际的“问题” -
Did you set the langage version in VS?我不团结......不确定它是否有帮助;)
-
@MarcGravell 大部分是因为谷歌。我得到类似
Assets\ml-agents-master\UnitySDK\Assets\ML-Agents\Scripts\SocketCommunicator.cs(1,7): error CS0246: The type or namespace name 'Google' could not be found (are you missing a using directive or an assembly reference?)的东西,知道我该怎么做吗?感谢您的宝贵时间 -
@nilsK 我认为这不是问题所在。不过还是谢谢 :)
-
你切换到
.NET 4.6了吗? (PlayerSettings -> Other Settings -> Scripting runtime Version)