So what you can do is to install a hook which is called when the project file is auto-generated, so you can open the project file yourself and add your customization to it (your customizations are not limited just to changing the language version: you could do more stuff, but you must understand what you are doing here).įor this purpose, place the following script inside the Editor folder: #if ENABLE_VSTU However if you edit a csproj file directly, Unity will automatically overwrite it at some point (Unity always auto-generate project and solution files). This doesn't mean that Unity will be able to compile all features of C# 7.3, but at least Visual Studio will not bitch about the features you are trying to use experimentally. We need to tell Visual Studio that your project supports the C# 7.3 language. Any scripts added to this folder will make Unity create a *.Editor.csproj project file, which holds contain scripts aimed to modify the Unity Editor.
Now, create a new folder named Editor inside your Assets folder.
Edit it and write the this line inside it: -langversion:experimental For that, just create the file mcs.rsp inside your Assets folder. We want to tell mcs.exe to process the C# code using the new "experimental" features of C# 7.
The Roslyn compiler is now supported in Unity 2018.3, which allows you to use the latest C# 7 features!įor Unit圓D Project Settings -> Player, find the Other Settings section, then under Configuration / Scripting Runtime Version choose.