.NET 7 support

Just saw that .NET 7 has great performance improvements to reflection, which is used a lot in Unity. When do you think we will see these improvements?

Source:

.NET 7 is still in preview. Like, Preview 1 only came out in February.

1 Like

This needs to go here: Unity Future .NET Development Status

2 Likes

You need to learn the difference in between the the C# the language (and it’s features), .Net bytecode format, and the .NET VM/runtime (there are multiple implementations of it) which runs the compiled code.

Unity is still using Mono and it’s own IL2CPP for executing .Net code depending on target configuration. Just because sooner or later Unity gets some of the C# language features introduced by new .Net version doesn’t mean that Unity will get the performance optimizations done in Microsoft implementation of .Net runtime (because Unity isn’t using it).

There are cases where performance improvements are being made possible by new language features, better standard library API or new bytecode instructions, in those cases there is hope that Unity will also benefit from them. But in case of many runtime improvements they are not relevant for Unity.

Now that Microsoft has open sourced latest versions of .Net runtime. Unity in theory could switch to it from Mono. But that will probably take a lot of work due to the integration with engine and editor tooling. It would also not eliminate IL2CPP as from what I understand that is at least partially motivated by JIT restrictions and lack of support on mobile and console platforms.

This is quite relevant for Unity, since Unity is already actively working on implementing the core CLR as the runtime.

2 Likes

Im just gonna leave a message to be notified when there are news about this…

If they get .NET 6 sorted migrating to .NET 7 should be a breeze. Unless they Frankenstein their own version of .NET 6 from the source like they did mono

2 Likes

As Lurking-Ninja said, we already have a thread on this. Please continue the discussion there.