NET 6 support

Since yesterday Microsoft announced the first .NET 6 preview it might be time to open this thread.

Announcement:

The biggest thing is that might be good for unity is that the mono runtime will be integrated into .NET and so TFMs will be available for window, android, ios, maccatalyst, macos, tvos.

Do you have any public roadmap for upgrading to .NET 6?
Do you have any plan on integrating with the standard .NET toolchain? Csproj files not auto generated, can be put under version control, nuget support, etc (this would also mean replacing asmdef?)?
net6.0-unity as workload please ?designs/accepted/2020/workloads/workloads.md at main · dotnet/designs · GitHub

Thanks in advance for @JoshPeterson for answering people’s obvious questions about it.

1 Like

From Blog:
We’ve been watching the Xamarin team innovate with the XAML Hot Reload experience over the last couple years and started to imagine enabling hot reload as a general .NET capability, and not just for XAML, but C#/IL. We’re defining a new hot code reload model that we can offer for all app types. It’s likely at least some of this feature will be implemented in the runtime, and we’re committed to doing that with both CoreCLR and Mono. We want to enable a very fast build, and even faster operations for code changes that can skip the build entirely, as a new standard feature of .NET.

1 Like

No, nothing public to report yet. I can say that we are actively working now toward the goal of .NET 5/.NET 6 class library support in Unity. Since .NET 6 will be a long term support release from Microsoft, we will likely target .NET 6 instead of .NET 5 for the first .NET Core-based release of Unity, but that is still uncertain.

This is a bit outside of the area my team supports, so I’m not as sure about these questions. I know there have been some discussions about moving to .csproj files from .asmdef, but I don’t think there is any active work here yet. I doubt that Unity will have built-in support for nuget soon.

I don’t expect this to happen. From a class library perspective, I think Unity will support .NET FW (probably version 4.8), .NET Standard 2.1, and .NET 5/6 in the future. Although Unity has a pretty large C# API, I don’t expect us to try to publish a TFM now. In essence, that means the Unity API would only be available in Unity, and not via nuget, for example. That would still allow parity with the current approach Unity has. So although have a Unity TFM would be interesting, not having one doesn’t loose anything.

I’d love to have more details to share, but we’re not ready to announce roadmaps publicly at this time.

13 Likes

Yeah, this is a really cool feature, and something that we have experimented with internally as well. It is certainly on our list of things to do.

11 Likes

8 Likes

Hold up, that’s just Blazor Server and MVC. Has anyone benchmarked general class library build times?

What made you think so? Was it pointless NET 5 thread that existed for 1+ years and ended up dead?

Share your feedback on what you want to see on Unity’s new roadmap website. https://resources.unity.com/unity-engine-roadmap/engineering?_ga=2.58055018.1958188071.1616602946-24445790.1611283440

This perfectly summarizes the state of the engine — optimistically.

3 Likes

Man… I was hoping that Unity would move to coreclr completely, years ago… People been complaining how slow mono was and still is even today

3 Likes

.NET 6 was just released. Interestingly, the diagram in the linked article depicts Unity as using .NET 6!

Is it a mistake or has the dream come true?

1 Like

We’re not ready to add .NET 6 support in Unity yet. But we are working toward that. There is a pretty in-depth discussion about our future .NET plans that we keep up to date here: https://discussions.unity.com/t/836646

2 Likes

.net 6.0 is the only version that seems to work with VSCode on M1 Macs btw. Opening unity projects with that setup makes omnisharp not work, meaning you don’t get any good intellisense

2 Likes

This might be unrelated to .NET 6 support in Unity itself. Does Omnisharp work in general on M1 macs? Or is this somehow specific to Unity?

Omnisharp only seems to work with .NET 6 in VSCode. Unity creates projects that target framework v4.7.1, which does not exist in .NET 6, so vscode (omnisharp) spits out an error like:

[fail]: OmniSharp.MSBuild.ProjectLoader
        This project targets .NET version that requires reference assemblies that do not ship with OmniSharp out of the box (e.g. .NET Framework). The most common solution is to make sure Mono is installed on your machine (https://mono-project.com/download/) and that OmniSharp is started with that Mono installation (e.g. "omnisharp.useGlobalMono":"always" in C# Extension for VS Code).
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'XXXX.csproj'.

If I install .NET 5 on my mac M1, vscode tells me it is not installed (because, from what I can tell, .NET 5 does not support M1)

So unfortunately, it seems like I cannot use VSCode for development on a mac M1. I have to use Visual Studio for Mac instead.

This isn’t a unity issue for sure, it’s likely a vscode/omnisharp issue, but I posted here to give another reason to support NET 6

1 Like

Thanks for the details - we don’t expect to target .NET 6 in Unity soon. We are working on it though - see the link above for some details.

OmniSharp on macOS/Linux uses Mono and contains a bundled version of Mono that is not compatible with Unity. I don’t think it matters what version of .Net you have installed.

In the official VSCode documentation on Unity Development with VS Code, it says:

And in the known issues for OmniSharp-VSCode:

So make sure you install mono and set useGlobalMono in VSCode to always.

Though I don’t have an Apple Silicon machine, so I don’t know if there are any specific issues but I’ve read that it should work with Rosetta.

3 Likes

UP

1 Like

Does .NET 6.0 are scheduled for support? .NET 6.0 has a lot of new features, and they definitely needed in Unity, at least Preview Features in .NET 6 - Generic Math - .NET Blog new math

We don’t have a release schedule yet, although we are working on it. See the large thread here with lots of details: https://discussions.unity.com/t/836646 unread