Updated scripting runtime in Unity 2018.1: What does the future hold?
Unity 2018.1 beta now includes a fully-supported, modern .NET runtime. As the .NET ecosystem continues to evolve, Unity is committed to maintaining feature compatibility with the latest and greatest in the .NET world.
How did we get here?
In Unity 2017.1, we shipped the first experimental preview of the stable scripting runtime. Throughout the 2017.2 and 2017.3 release cycle, many Unity users worked with this experimental scripting runtime and provided invaluable feedback (thanks, everyone!). We’ve also worked closely with excellent developers from Microsoft, both on the Mono and Visual Studio teams. As we’ve sorted out issues and corrected bugs, the modern scripting runtime has become more and more stable. In 2018.1 we feel it is ready for widespread use. So if you’ve not tried it yet, please do so now!
Why should I try it?
The stable scripting runtime brings a number of modern C# and .NET features to Unity. Specifically, you’ll get access to:
- C# 6
- The .NET 4.7.1 class libraries
- Support for assemblies built against .NET Standard 2.0 and 1.x
- Managed code debugging with IL2CPP (experimental in 2018.1 for standalone players, expect full support in the next few releases)
What .NET Profile should I use?
The stable scripting runtime comes with two new .NET profiles. A .NET profile defines the API surface your code can use for the .NET class libraries. You can choose the .NET profile for your player build via the “Api Compatibility Level” option in the Player Settings. The two .NET profiles Unity supports are
- .NET Standard 2.0
- .NET 4.x.
The .NET Standard 2.0 profile matches the profile of the same name published by the .NET Foundation. This is a great profile to choose for a new Unity project. It is smaller than .NET 4.x and we recommend it for size-constrained platforms such as mobiles. In addition, we’ll make sure this profile works on all platforms Unity supports. If you are a developer of libraries used with Unity, this is the profile you want to target.
The .NET 4.x profile provides access to the latest .NET 4 API. This includes all of the code available in the .NET Framework class libraries. It also supports all of the .NET Standard 2.0 profiles, so it will work with managed plugin assemblies built against .NET Standard 2.0. While it provides access to a large API, some parts of that API will not work on all platforms. If your project requires functionality not exposed in .NET Standard or has legacy code, this may be a good option.
What does the future hold?
Now that the modern scripting runtime is fully supported, we’re committing to maintain it for all future versions of Unity. We’re also working on TLS 1.2 support across all platforms and improvement in build size and build times with the modern scripting runtime.
The legacy scripting runtime will remain the default for new projects in 2018.1. During the 2018.x release cycle, we will change the default scripting runtime for new projects to be the stable scripting runtime. We will deprecate the legacy scripting runtime, although it will be fully supported for existing projects.
We are aggressively working to remove the legacy scripting runtime, and make the stable scripting runtime the only option. We recommend all users start the process of migration to the stable scripting runtime soon. As our focus shifts to the stable scripting runtime, we limit the bugs fixed in the legacy scripting runtime. Additional guidance will follow about the deprecation and removal schedule for the legacy scripting runtime.
At Unity, we’re excited about the recent evolution of the larger .NET ecosystem. As it continues to improve we’re dedicated to bringing the latest .NET tools to Unity developers, like C# 7, so stay tuned!
We’re looking forward to discussing our runtime upgrade and upcoming scripting features in this corner of Unity Forums!
32 КомментарииПодписаться на комментарии