Can Unity work with C# 6 code and how? Can I install some (free) features to do it? I know there is something like unityninjas that you can use, but it is $25.
I know also that Unity works whit something between C# 3 and 4 in terms of features. If I work with C# 6.0, it always gives me compiler errors. Here are some code examples:
using static System.Convert;
using static System.Environment;
$"€{punten}{NewLine}€{Money}{NewLine}€{KilledEnemies}{NewLine}€{bonus}{NewLine}€{total}";
I use Visual studio as code editor and build with no errors. If I press play in Unity it won’t build because this are the features of C# 6.0.
Afraid not.
IMHO… Unity has a “c# - like compiler”, but is in no compulsion to keep up with the m$…
The accepted answer from TSRajesh was correct at the time, but things have changed recently.
In the Unity editor, go to
Edit- Project Settings - Player - Other Settings → Configuration -Scripting Runtime Version
There you can switch from “Legacy .NET 3.5” to a more recent version.
See the original announcement here:
This says it was experimental at the time, but it’s now stable.