Unity Roslyn Updater

October 27, 2025 ยท View on GitHub

A tool to update the Roslyn compiler and C# language versions for a Unity installation.

Installation

NOTE: This will modify your Unity installation folder, administrative privileges are required!

Interactive Mode

Launch the tool directly to interactively select a Unity editor version to patch.

Command Line (Advanced) Mode

Pass the Unity editor path to UnityRoslynUpdater.exe:

UnityRoslynUpdater.exe <path to Unity Editor folder>

For example: UnityRoslynUpdater.exe "C:\Program Files\Unity\Hub\Editor\2022.3.8f1\Editor"

Usage

After updating the Roslyn compiler, newer C# language versions are available but not enabled by default. To enable them, you must explicitly opt in for each assembly definition in your project.

Create a csc.rsp file in the same directory as your assembly definition (.asmdef) file with the following content (replace 14 with your desired language version):

-langversion:14

NOTE: Version 2.0.24 or later of the com.unity.ide.visualstudio package is required for the language version specified in csc.rsp to be reflected in the generated .csproj files.

Language Support

  • Working
    • Feature works exactly as expected.
  • PolySharp
    • Feature works when using PolySharp and/or manually implementing missing APIs.
  • Not Supported
    • Requires runtime features or BCL changes that Unity does not have. Attempting to use the feature may result in compiler errors.
  • Crash
    • Requires runtime features that Unity does not have. Attempting to use the feature may compile, but will result in crashes.

C# 14

FeatureStatus
Extension membersWorking
Null-conditional assignmentWorking
nameof supports unbound generic typesWorking
More implicit conversions for Span<T> and ReadOnlySpan<T>Working
Modifiers on simple lambda parametersWorking
field backed propertiesWorking
partial events and constructorsWorking

C# 13

FeatureStatus
params collectionsWorking
New lock type and semanticsNot Supported
New escape sequence - \eWorking
Method group natural type improvementsWorking
Implicit indexer access in object initializersWorking
Enable ref locals and unsafe contexts in iterators and async methodsWorking
Enable ref struct types to implement interfacesNot Supported
Allow ref struct types as arguments for type parameters in genericsNot Supported
Partial properties and indexersWorking
Overload resolution priorityPolySharp
field backed propertiesWorking

C# 12

FeatureStatus
Primary constructorsWorking
Optional parameters in lambda expressionsWorking
Alias any typeWorking
Inline arraysNot Supported
Collection expressionsWorking
InterceptorsNot Supported

C# 11

FeatureStatus
Raw string literalsWorking
static abstract/static virtual members in interfacesNot Supported
Checked user defined operatorsWorking
Relaxed shift operatorsWorking
Unsigned right-shift operatorWorking
Generic attributesCrash
UTF-8 string literalsWorking
Newlines in string interpolationsWorking
List patternsWorking
File-local typesWorking
Required membersPolySharp
Auto-default structsWorking
Pattern match Span<char> or ReadOnlySpan<char> on a constant stringWorking
Extended nameof scopeWorking
Numeric IntPtr and UIntPtrWorking
ref fieldsNot Supported
ref scoped variablesPolySharp
Improved method group conversion to delegateWorking

C# 10

FeatureStatus
Record structsWorking
Improvements of structure typesWorking
Interpolated string handlerPolySharp
Global using directivesWorking
File-scoped namespace declarationWorking1
Extended property patternsWorking
Lambda expression improvementsWorking
Constant interpolated stringsWorking
Record types can seal ToStringWorking
Assignment and declaration in same deconstructionWorking
Improved definite assignmentWorking
Allow AsyncMethodBuilder attribute on methodsNot Supported2
CallerArgumentExpression attributePolySharp
Enhanced #line pragmaWorking
  1. Unity 2021 and earlier require UnityNamespacePatch to be installed.
  2. AsyncMethodBuilderAttribute requires changes to its [AttributeUsage] attribute for this to work.