Unity devs warned of breaking changes ahead in video game engine as team gets to grips with mutating face of .NET

Support has fallen behind and fixing it is a challenge

Unity software developer Josh Peterson has spoken about the future of .NET support in the widely used game development engine.

Use in game development is one of the bright spots for C# popularity, according to a survey late last year, but its use in Unity is somewhat messy.

The C# scripting engine is based on Mono but developers may also use .NET Framework when running on Windows. Mono is the old open-source implementation of .NET, from before Microsoft itself came out with .NET Core. Microsoft acquired the stewardship of Mono with Xamarin in 2016, and Mono now shares substantial code with .NET Core, but it remains distinct and the runtime is still used in some scenarios.

Unity maintains its own fork of Mono, which Peterson said is "about two years behind the latest upstream code." The team is now updating this to the latest code from the upstream Mono repository, a change he is "95 per cent confident" will make it into the next release, Unity 2021.2. He added that this exercise will improve performance and fix bugs but in itself "won't have any new .NET features" – though it lays the ground for features to be added in future.

That said, Peterson does expect to add support for .NET Standard 2.1 in Unity 2021.2, but this time with only "75 per cent confidence." The .NET Standard versions define the set of APIs that a .NET implementation must support. A tricky aspect of .NET Standard 2.1 is that .NET Framework is stuck forever on .NET Standard 2.0. Peterson said: "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."

The upgrade cannot come soon enough for some developers frustrated with the slow progress. "Are there any strides towards ditching Mono in favour of a complete .NET integration? Especially now when .NET is becoming so cross-platform," asked a user in August last year. In-demand features include Span<T>, introduced in C# 7.2, and the Range operator, introduced in C# 8.0. Microsoft released C# 8.0 in September 2019, and getting the complete set of features into Unity has taken a long while. Users are also concerned that .NET performance in Unity has fallen behind.

Peterson said that C# 8.0 support will still be based on Mono in 2021.2. He also expressed hope that C# 9.0, released by Microsoft in November 2020, will be supported, but this depends on adding features to Mono and to IL2CPP (which converts .NET code to C++ for compilation), and for this his confidence descended to 50 per cent, he said.

As for that request to migrate to .NET Core, this is not likely soon. Peterson said that Unity will probably skip .NET 5 in favour of .NET 6, which is the forthcoming long-term support release. Even then, he said that "it looks like the JIT runtime here will be Mono" but he is uncertain and added that "we may need to move directly to CoreCLR for .NET 6 support."

One of the issues is that a feature of the Unity editor called domain reloading, which resets the scripting state, depends on a feature (AppDomains) that does not exist in .NET Core. Peterson said this could be implemented another way but "will be a breaking change." For game developers, .NET 6 will be a breaking change anyway since "any assemblies compiled against mscorlib.dll from the .NET Framework ecosystem will not work, and must be recompiled."

The complexity around .NET Standard, .NET Framework, .NET Core, and Mono is a challenge for Unity's developers, and shows that Microsoft's unification of .NET is in reality a process, not something that happened overnight with the release of .NET 5.0 last year.

"The only thing I'm interested in is the .NET 6 support. The biggest problem I had was slow Editor performance and long iteration time as project size grows. I currently ditched Unity because it was too painful to use and moved to Unreal right now," said another user, adding that "Mono will be history soon and it has no future."

In a separate post, Peterson emphasised that "everything discussed here is subject to change. Please do not consider discussions on this thread to be official announcements." Instead, he said that they offer "insight on our progress." ®

Similar topics

Broader topics

Other stories you might like

  • Experts: AI should be recognized as inventors in patent law
    Plus: Police release deepfake of murdered teen in cold case, and more

    In-brief Governments around the world should pass intellectual property laws that grant rights to AI systems, two academics at the University of New South Wales in Australia argued.

    Alexandra George, and Toby Walsh, professors of law and AI, respectively, believe failing to recognize machines as inventors could have long-lasting impacts on economies and societies. 

    "If courts and governments decide that AI-made inventions cannot be patented, the implications could be huge," they wrote in a comment article published in Nature. "Funders and businesses would be less incentivized to pursue useful research using AI inventors when a return on their investment could be limited. Society could miss out on the development of worthwhile and life-saving inventions."

    Continue reading
  • Declassified and released: More secret files on US govt's emergency doomsday powers
    Nuke incoming? Quick break out the plans for rationing, censorship, property seizures, and more

    More papers describing the orders and messages the US President can issue in the event of apocalyptic crises, such as a devastating nuclear attack, have been declassified and released for all to see.

    These government files are part of a larger collection of records that discuss the nature, reach, and use of secret Presidential Emergency Action Documents: these are executive orders, announcements, and statements to Congress that are all ready to sign and send out as soon as a doomsday scenario occurs. PEADs are supposed to give America's commander-in-chief immediate extraordinary powers to overcome extraordinary events.

    PEADs have never been declassified or revealed before. They remain hush-hush, and their exact details are not publicly known.

    Continue reading
  • Stolen university credentials up for sale by Russian crooks, FBI warns
    Forget dark-web souks, thousands of these are already being traded on public bazaars

    Russian crooks are selling network credentials and virtual private network access for a "multitude" of US universities and colleges on criminal marketplaces, according to the FBI.

    According to a warning issued on Thursday, these stolen credentials sell for thousands of dollars on both dark web and public internet forums, and could lead to subsequent cyberattacks against individual employees or the schools themselves.

    "The exposure of usernames and passwords can lead to brute force credential stuffing computer network attacks, whereby attackers attempt logins across various internet sites or exploit them for subsequent cyber attacks as criminal actors take advantage of users recycling the same credentials across multiple accounts, internet sites, and services," the Feds' alert [PDF] said.

    Continue reading

Biting the hand that feeds IT © 1998–2022