News

Unity Game Platform Details Plans for .NET and C#

Unity Technologies, known for its real-time development platform used widely for gaming apps, has detailed its plans for incorporating new changes in .NET and C# being pushed out by Microsoft.

The two companies have close ties, with the game platform replacing its Mono-based IDE with Visual Studio way back in 2018, after which Microsoft published Unity guidance in both videos and even a Build Unity Games with Visual Studio site:

Visual Studio Unity Site
[Click on image for larger view.] Visual Studio Unity Site (source: Microsoft).

There's also a Visual Studio Tools for Unity site that contains documentation for the same-named extension.

Unity testing and debugging was also beefed up in the recent release of Visual Studio for Mac v8.9.

Last week, Unity's Josh Peterson announced its plans in a forum post titled "Unity Future .NET Development Status," cautioning that the thread discussions shouldn't be considered official announcements:

We've had a good bit of interest on various forum threads about Unity's plans for C# and .NET in the future. Microsoft has been pushing the .NET ecosystem in a number of beneficial directions, and we at Unity want to bring those improvements to our users as soon as we can.

While we are not in a position to mention specific details about when various newer .NET features will come to Unity releases, we would like to provide more transparency into our ongoing work to bring these features to Unity.

Our goal with this forum thread is to provide updates on what we are working on, and when we think it will be available to Unity releases. As with any large software project, there are many unknowns, so everything discussed here is subject to change.

With that said, Peterson's first post detailed the following:

  • Update Unity's fork of Mono to the latest code from the upstream Mono repo: This is about two years behind the latest upstream code, and while the update won't provide new .NET features, it will help ship such features in future releases. Peterson further said:
    • 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.
  • Add support for .NET Standard 2.1: This will expose user-requested APIs such as Span and ranges. "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."
  • Complete C# 8 support: This comes with the aforementioned .NET Standard support along with the latest Mono code that features default interface methods support.
  • 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."
  • .NET 6 support: Peterson described this as "still a bit fuzzy," with the company hoping to provide a preview around the time the landmark, unifying, milestone .NET 6 ships in November as a long-term support (LTS) release, meaning that "Unity will likely skip .NET 5 entirely." He described the biggest hurdles for this as:
    • This is a breaking change for all Unity users. Any assemblies compiled against mscorlib.dll from the .NET Framework ecosystem will not work, and must be recompiled.
    • The .NET Core ecosystem does not support domain reloading, which is a fundamental requirement of the Unity Editor. We have done work to use Assembly Load Context instead, but that will be a breaking change, and will require time to implement properly, both from the Unity side and in user projects.

Speaking to the popularity of Unity in the .NET development ecosystem, more than 100 comments were appended to the post, many going into great detail about technical issues and more broad comments, such as this one about Visual Studio integration:

This is great news and something I hope that comes sooner rather than later, and that you can stay up to date with the latest releases!

One thing I think you guys really need to get on is the Visual Studio integration. Unity projects are still dodgy and not real .csproj files, and lack features such as project references, which is really important for some projects such as Client/Server games, where multiple projects are needed, with shared projects between. Something I am working on. I was shocked to find out a few months ago that project references are not supported, and that I had to add post-build command arguments to copy the generated DLL files into the unity scripts folder to use them, this is just a bit dodgy and removes features such as debugging and being able to step into code from the shared project, as there is no code available in the DLLs, metadata.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube