We wanted to give an update about our current progress towards support of new .NET features in Unity. I’ll try to list the work items we know about now and provide both a likely release as well as confidence about how likely we are to make that release goal.
Everything here is subject to change!
Update Unity’s fork of Mono to the latest code from the upstream Mono repo
(You can follow the development in our fork here: GitHub - Unity-Technologies/mono at unity-master-new-unitychanges)
Unity’s fork of Mono is about two years behind the latest upstream code.
- So this effort pulls in many bug fixes from upstream Mono.
- It also improves the managed debugger.
- It will allow Mono to run in 32-bit floating point mode, improving floating point performance.
- It brings in more .NET Core class library implementation, including many changes to the way the class library code interacts with platform-specific code.
When this change is available in Unity, it won’t have any new .NET features. But it does provide us a firm foundation to use to ship new .NET features in Unity.
The internal cut-off for Unity 2021.2 is approaching (weeks away), but we are 95% confident that this work will land in time.
EDIT: This work landed in Unity 2021.2.0a18
Add support for .NET Standard 2.1
Many of the API that users have been asking for from .NET Core (namely Span and ranges) are in .NET Standard 2.1. We’re planning to first add .NET Standard 2.1 support to Unity’s existing .NET Framework-based ecosystem. Although .NET Framework does not support .NET Standard 2.1, Mono’s class libraries do support it, so we should be able to provide a nice bridge to a .NET Core-based ecosystem.
We’re hoping to get this into Unity 2021.2, but it is not far along enough to be sure, I’m 75% confident that we will make it though.
EDIT: .NET Standard 2.1 support will be available in Unity 2022.1.0a3. It will also be available in a 2021.2 beta release. I’ll update here when I know the version.
EDIT 2: .NET Standard 2.1 support will be available in Unity 2021.2.0b6.
Complete C# 8 support
The newest Mono code mentioned above has default interface methods support. We still need to add this support to IL2CPP as well.
This, along with .NET Standard 2.1 support, will give Unity users full access to C# 8 features.
We’re hoping to get this into Unity 2021.2, but it is not far along enough to be sure, I’m 75% confident this one will make it as well.
EDIT: Default interface methods support is available in both Mono and IL2CPP in Unity 2021.2.0a21 and later.
EDIT 2: I was incorrect, Unity 2021.2.0a21 does not yet have default interface methods support. I’ll update this part of the post later when we actually have it shipped properly.
EDIT 3: Default interface methods support (and full C# 8 support) will be available in Unity 2022.1.0a3. It will also be available in a 2021.2 beta release. I’ll update here when I know the version.
EDIT 4: Default interface methods and full C# 8 support will be available in Unity 2021.2.0b6.
Complete C# 9 support
We’d like to have covariant return type support in Mono and IL2CPP for Unity 2021.2. This will bring full C# 9 support to Unity users as well.
We still have some discovery to do on this one, so I’m maybe 50% confident this will make Unity 2021.2.
EDIT: We don’t plan to have covariant return type support in Unity 2021.2. Other C# 9 features that do not depend on runtime support are present in Unity 2021.2 alphas.
Future .NET support
We are actively working on supporting .NET in Uinty, both in the Unity editor and for all player platforms. The latest information about this is available in a blog post, which includes a link to a GDC 2022 talk about our plans.
We’re not far along enough in this work yet for me to give a meaningful confidence level about when it will ship, but watch this thread and the Unity blog for updates.
EDIT: We’re planning to move directly to the CoreCLR technology a JIT runtime for .NET 6/7 support.
EDIT: I’ve updated our current status for future .NET 7/8 support and linked to our blog post and talk about the plans.
EDIT (October 27, 2023): We’re focused internally on developing and shipping new .NET support, with our current target being .NET 8. We don’t have a shipment date to share publicly yet, but I’ll respond on this forum thread with details when I do.