当前位置:网站首页>Unity engine starts to migrate from mono to.Net coreclr
Unity engine starts to migrate from mono to.Net coreclr
2022-07-27 06:15:00 【YF Yunfei】
present situation

Unity The engine development team announced , They have begun to Unity Engine runtime from Mono Migrate to .NET CoreCLR.
Besides , They will also provide integration JIT and AOT Solutions for —— Integration IL2CPP and Burst, To achieve Compile time efficiency and Code generation quality The best balance between .
at present ,Unity Migrate to .NET CoreCLR The work involved in the runtime has begun . The team said it was a very challenging journey , In order to successfully complete the migration , They will solve the problem step by step , And ensure that the existing Unity Gradually release updates in the way of project stability .
therefore , The development team will complete the migration in multiple stages :
- First , Stand alone for the desktop platform player Provide right .NET CoreCLR Support for . Based on this , Developers can use the player Select this runtime and the existing... In the settings Mono and IL2CPP Back end .
The team thinks , This stage can help them migrate Unity The core part of the engine ( Much smaller than the Editor section ), It is expected to solve most of the technical challenges involved in this migration . Developers will still pass at this stage .NET Standard 2.1 API visit .NET Runtime , Their goal is to 2023 New runtime released in . - And then in the second stage , The team will take Unity Migrate editor to .NET CoreCLR, At the same time, cancel .NET Mono Runtime support . The challenge in the second stage is , How to use AppDomain Reload the script in the editor , And complete the report to .NET CoreCLR Handoff . It will also involve upgrading IL2CPP To support from dotnet/runtime The base class library of the warehouse . Developers can eventually access the full .NET 7.x or 8.0 API.Unity The team is planning on 2024 A new editor was released in .
foreign ,Unity Is working with Microsoft and JetBrains And other industry partners , Increase participation in the open source community , In order to ensure that Unity Creators can use the latest .NET technology .
In the past
In the past ,Unity choice Mono
As early as 2008 year ,Unity Just announce and Mono cooperation , But then Mono The new version uses SGen GC replace Boehm GC when ,Unity Don't want to pay the license fee again . Until now (2021 year 7 month ),Unity Still rely on Boehm GC. This is a kind of There are no generations ( Slow scanning )、Mark-Sweep Of ( There will be memory fragmentation )、 conservative ( Can't accurately identify garbage ) Of GC.
about Boehm GC Performance problems caused by ,Unity There are some official compromises .
- Try to allocate the memory of all objects first , Then close it GC, Wait until the right time ( If the level ends ), And open GC;
- Default on incremental Mode framing , Note that if there is a lot of rewriting of reference relations during , Framing processing will have a lot of additional performance loss ( Mainly from the writing barrier )
future
future ,Unity choice CoreCLR
since 2016 Microsoft will Mono The license of is issued by GPL Change it to MIT since ,Unity And joined in .NET Foundation, Start putting the latest Mono Integrate into your own engine . But as Microsoft builds a unified open source solution .NET 5,Unity It seems to change the original idea . Their plans can be summarized from the official forum :
- First, integrate the latest Mono, Because it supports .NET Core Of BCL;
- And then put their own IL2CPP Also updated ( It depends on Mono Output result of );
- Unity 2021.2 Start to fully support .NET Standard 2.1,C#8 And part C#9(Span,Range,default interface methods), among
SpanThe impact is very far-reaching , At present and BurstCompiler Of NativeArray It can't be converted seamlessly , The biggest difficulty yes Span I don't have my own memory But the latter has ; - Support C#9/10, Based on the previous work , This step is not difficult ;
- Support .NET 6( skip .NET 5).
- use CoreCLR replace Mono(GC It is also upgraded to CoreCLR GC), Before that ,GC It doesn't upgrade to Mono Of SGen. This work will last for a long time , Not yet ETA.Unity Most of the code is C++,C# Only thin A thin layer ( But more and more code is switching to C#). Switching to CoreCLR after , Its visit Managed Object The way we do it needs to be completely changed , So the change will be very big . The overall order is : First the Player Replace with CoreCLR, And then Editor Also replace .
- There are two problems :
- all dll Must recompile
- To be modified UnityEditor Medium to large use AppDomain Conduct hot reload Part of (AppDomain In the new .NET Is almost abandoned , Source )); Current alternative classes AssemblyLoadContext It cannot be provided before AppDomain Reload All functions of
In general Assembly Load Context is cooperative, and any remaining references (static fields, GC Handles, running threads, etc) will prevent the code from being unloaded.
In the long run ,Unity The team has realized some of its wheels (Coroutine, Customized Boehm GC, IL2CPP, asmdef etc. ) In recent years .NET Runtime 、 The tool chain and the rapid development of the whole ecosystem seem a little old , Is committed to providing developers with authentic .NET Development experience ( Source ), At the same time, try not to subvert the original usage habits ( For example, out of These reasons ,UPM Don't and NuGet Two way communication ).
in addition ,Unity The team still has many high priority feature Want to do , All in all , Or hope Unity Better and better !
边栏推荐
- 学习软件测试时需要配备的运行环境需求搭建
- socket 长链接
- Automated Deployment Project
- Li Kou daily question sword finger offer II 091. paint the house
- 导航相关消息
- [Arduino] reborn Arduino monk (1)
- 自动化部署项目
- 多线程CAS、synchronized锁原理 、JUC以及死锁
- Pzk learns data types, binary conversion, input and output, operators, branch statements, ifelse of C language
- 论文写作(收获)
猜你喜欢

ROS运行管理之launch文件

How to choose the correct server backup method

ULCL功能--5GC

What is the difference between single line and three line when renting servers in Hong Kong?
![[first song] machine learning of rebirth - linear regression](/img/70/3efd9eacf88f55022eb52d096926f7.png)
[first song] machine learning of rebirth - linear regression

遥感影像识别进展2022/5/5

Leetcode one question per day 30. Concatenate substrings of all words

IP核之RAM

ROS节点名称重名

Socket long link
随机推荐
5G的前世今生---简述移动通信的发展
无法启动程序,拒绝访问?
How to distinguish an independent server from a VPS host?
Code implementation and introduction of all commonly used sorting
Unity 实用小技巧(更新ing)
IP核小结
力扣题解 二叉树(6)
Linked list palindrome judgment
[song] rebirth of me in py introductory training (9): exception handling
Pycharm installation and import project considerations
力扣 110. 平衡二叉树
ROM of IP core
力扣题解 动态规划(5)
Reading and writing of C # file
5G网络身份识别---详解5G-GUTI
力扣每日一题 剑指 Offer II 091. 粉刷房子
Unity 菜单界面的简单介绍
自动化部署项目
Understand the pointer in a picture
导航相关消息
