Warning for developers about upcoming critical changes in the engine
Engine support is lagging, and fixing the situation is not an easy task
Unity software developer Josh Peterson told us about the future of .NET support in a widely used game development engine.
According to a survey conducted at the end of last year, the use of C # in game development is one of the main reasons for the popularity of C #, but its implementation in Unity is somewhat messy.
The C # scripting engine uses Mono, but developers can also use the .NET Framework on Windows. Mono is an old open source implementation of .NET dating back to before Microsoft released .NET Core. Microsoft gained control of Mono with Xamarin in 2016, and Mono now shares a lot of code with .NET Core, but it still remains a separate product that still uses runtime in some scenarios.
Unity maintains its own fork of Mono, which, according to words Peterson, “is about two years behind the upstream code.” The team is now updating it to the latest version of the code from the Mono upstream repository – a change in which he is “95% sure” it will make it to the next release, Unity 2021.2. He added that this work will improve performance and fix bugs, but by itself “will not bring any new features to .NET” – although it lays the foundation for features that will be added in the future.
However, Peterson expects support for .NET Standard 2.1 to be added in Unity 2021.2, but this time with “75% confidence.” .NET Standard versions define a set of APIs that a .NET implementation must support. The tricky aspect of .NET Standard 2.1 is that the .NET Framework is forever stuck on .NET Standard 2.0. Peterson says, “While the .NET Framework does not support .NET Standard 2.1, the Mono class libraries do, so we should be able to build a good bridge to the .NET Core ecosystem.”
This update may not happen quickly, which is why some developers are frustrated with such slow progress. “Are there any moves towards ditching Mono in favor of full .NET integration? Especially now that .NET is becoming so cross-platform. ” asked the user last August. Featured features include the Span
Peterson says support for C # 8.0 in 2021 will continue to be implemented on top of Mono. He also hoped that C # 9.0, released by Microsoft in November 2020, would also be supported, but that depended on the addition of features to Mono and IL2CPP (which converts .NET code to C ++ for compilation), which his confidence dropped to 50%. , he said.
As far as the move to .NET Core is concerned, it’s unlikely to be coming soon. Peterson said Unity is likely to ditch .NET 5 in favor of .NET 6, which is an upcoming long-term support release. Even then, he remarked that “it looks like the JIT runtime will be Mono here,” but he’s not sure about that and added that “we might need to go directly to CoreCLR in order to support .NET 6.”
One issue is that the Unity editor feature called domain reloading, which resets script state, depends on a feature (AppDomains) that is not available in .NET Core. Peterson says it could be done in a different way, but “it will be a breaking change.” For game developers .NET 6 will be a breaking change anyway, as “any assemblies compiled using mscorlib.dll from the .NET Framework ecosystem will not work and must be recompiled.”
The complexity of the .NET Standard, .NET Framework, .NET Core, and Mono is a challenge for Unity developers and shows that the .NET unification that Microsoft has pioneered is actually a lengthy process, not something that can happen in overnight with the release of .NET 5.0 last year.
“My only concern is .NET 6 support. The biggest problem I encountered was poor editor performance and long iteration times as the project grew in size. Currently I ditched Unity because it was too awkward to use and switched to Unreal. ” said another user, adding that “Mono will soon be history and has no future.”
IN separate post Peterson stressed that “everything discussed here is subject to change. Please do not treat the discussions in this thread as official announcements. ” Instead, he said that he rather offers us “an understanding of their progress.”
On the eve of the start of the “Unity Game Developer. Professional” course, we invite everyone to attend a free two-day intensive, within which we will develop all the necessary tools and architecture for the dialogue system (so that our character can communicate with non-player characters), implement inventory, add merchants to the game and we will create a quest system. Just two lessons and an almost finished RPG in your pocket.