Que recherchez-vous ?
Hero background image
Unity 2020.2
Programmer tools
Improve your scripting workflows with Unity 2020.2. Use our improved tools for programmers to iterate faster and optimize your projects for maximum performance. 

What’s new in 2020.2

Discover some of the major improvements and new features for programmers in Unity 2020.2. For full details, check out the release notes.

Improve compilation times with deterministic compilation
Improve compilation times with deterministic compilation

As projects grow in complexity, new code changes can take longer to compile and take a toll on your team’s productivity. Unity 2020.2 offers a “-deterministic” compilation option when compiling C# scripts. This option lets you avoid unnecessary recompiling of assembly definition (.asmdef) references if the public metadata for the assembly does not change when compiling scripts for the Editor. This is particularly useful for reducing iteration time when you’re making changes to assemblies that have many direct and/or indirect references.

C# 8 support

Unity 2020.2 supports all the newest C# 8 features and enhancements, except for default interface methods. This includes nullable reference types, enabling the compiler to show a warning each time you attempt to assign null to a reference type variable. Switch expression with pattern matching offers you a more streamlined way to write conditional code.

For a complete overview of everything new in C# 8, check out the Microsoft documentation.

Root Namespace available in the Assembly Definition settings

Namespaces in C# provides an efficient way to organize your code and avoid class naming collisions with other packages and libraries. Root Namespace is now available as a new field in the asmdef inspector and is used to automatically add a namespace when creating a new script in Unity and in Visual Studio and Rider.

Remember to update the Visual Studio and Rider packages to the latest version if you plan to use this functionality.

Comparison of Serial and Parallel IL2CPP conversion time of two projects before and after multithreaded conversion. The red line is an internal demo, and the orange one is a project from an external studio.
Faster build compilation

Unity 2020.2 comes with significant improvements to the build compilation time. If you make changes that don’t involve code, for example, materials, shaders or prefabs, the IL2CPP conversion from .NET assemblies to C++ will be now skipped entirely when building a player.

In Unity 2020.2 the IL2CPP conversion takes advantage of modern multicore processors by going from single to multithreaded, dramatically decreasing the overall IL2CPP player build times, as demonstrated in the above test project data.

Consistent Time.deltaTime

Unity 2020.2 fixes the inconsistent Time.deltaTime values that lead to stuttering object movements during gameplay. The TimeManager interface has now been refactored in a way where frame time calculations are more stable, providing much smoother object movement when the game is running at a stable frame rate. Unity 2020.2 supports these time stability improvements on iOS, macOS, PS4, Switch, tvOS, UWP, Windows and Xbox One. Improvements on Android, Windows/Linux on Vulkan and XR will come later. Check out the blog post for details.

The overall optimization was found to be between 12 and over 800 times faster when processing 100 to 5,000 importers (for overall improvement, see the graph on the right).
Performance improvements

Unity 2020.2 features several significant optimizations, including to Nested Prefabs, resulting in dramatically faster sorting and faster lookups. Searches in the Editor scripted importers registration function have tested to be up to 800 times faster. Finally, the Optimization Team also refactored Camera.main, reducing the time it takes to query it, by hundreds of milliseconds in some projects.

Editor Coroutines and faster workflows with Configurable Enter Play Mode
Editor Coroutines and faster workflows with Configurable Enter Play Mode

No longer an experimental feature, Configurable Enter Play Mode enables you to disable either, or both, of the “Domain Reload” and “Scene Reload” actions to speed up entering Play Mode. With Editor Coroutines, now out of Preview, you can start the execution of iterator methods within the Editor, similar to how Coroutines inside MonoBehaviour scripts are handled during runtime.

Managed code stripping with Unity Linker

Unity Linker performs static analysis to strip managed code. It also recognizes a number of attributes and allows you to annotate dependencies where it is unable to identify them. In Unity 2020.2 the tool received API updates to match Mono IL Linker. Starting with Unity 2020.1, Unity Linker can detect some simple reflection patterns, lessening the need to use link.xml files.

Profiler updates
Profiler updates

You can now add charts in the Profiler Window to get more performance insights and context for either existing or user-generated Profiler statistics. At the same time, Flow Events can display serial task dependencies in the Profiler Timeline and help you identify which tasks in a sequence of operations your application is spending time on.

You can now visualize render and memory Profiler stats in Players. Expose existing Profiler stats using the runtime API, and read the values of performance statistics for the existing Profiler areas such as memory, rendering and others in Players. Use that data to display performance heads-up displays (HUDs) while running your project on the target device or build other performance tooling for your own needs.

Roslyn analyzer improvements

The compilation pipeline now supports Roslyn analyzers. This enables you to run C# code analyzers asynchronously in the background inside the Unity Editor without interrupting your iteration workflow. You can also run them synchronously from the command line.

Roslyn analyzers and ruleset files in Unity projects are powerful tools to help inspect your code for style, quality, and other issues. You can use existing analyzer libraries to inspect your code and write your own analyzers to promote the best practices or conventions within your organization.

Unity Safe Mode

Unity Safe Mode improves how Unity behaves when opening a project that has script compilation errors. If compilation errors are detected at Editor startup, you will now be prompted to enter Safe Mode. This presents you with an environment designed for resolving them, so that you can quickly return your project to a functional state, without waiting for unnecessary imports of your project’s assets. This feature will simplify and speed up the process of upgrading a project to a new Unity version, and it will help teams working on large projects by reducing the number of cases in which the library folder contains incorrect import artifacts.

Download Unity 2020.2 now
Download Unity 2020.2 now

Get access to all of the above and much more today.