Follow the following steps to enable the latest C# syntax for your Unity project.
Only tested with Scripting Backend
set to Mono
and Api Compatibility Level
set to .NET Standard 2.1
.
In Edit
> Project Settings...
> Player
> Other Settings
> Additional Compiler Arguments
, add /langversion:latest
, then Apply
.
Put LangVersionPostprocessor.cs
under the <project_root>/Assets/Standard Assets/Editor
folder.
You may change its filename and classname.