Search code examples
c#unity-game-engineml-agent

error CS1644: Feature `null propagating operator' cannot be used because it is not part of the C# 4.0 language specification


I have Unity 2018.1.9f2 and I downloaded the Unity ml agents and added the folder to my unity project. But When I try to run the '3DBall' scene I get this error in the console:

Assets/ml-agents-master/UnitySDK/Assets/ML-Agents/Scripts/Brain.cs(79,25): error CS1644: Feature null propagating operator' cannot be used because it is not part of the C# 4.0 language specification. When I double click it then it opens the VS and brainBatcher?.SendBrainInfo(name, agentInfos); is underlined. and when I hover over the code it says Feature 'null propagating operator' is not available in C# 4. Please use language version 6 or greater.

I tried to follow the answer from anther similar question: Unity Visual Studio C# version synchronization. So I used unity-c-5.0-and-6.0-integration and that error was not displayed but I got 150+ other errors.

Any help will be much appreciated.


Solution

  • Make sure your Player Settings / Scripting Runtime Version is set to .NET 4.x not .NET 3.5

    scripting runtime version