默认的__脚本运行时版本__为 .NET 4.6。(.NET 3.5 标记为已弃用。)此选项是视项目而定的设置,在 Unity Editor Player 设置(__Edit > Project Settings__,然后选择 Player 类别)的 Configuration 部分中指定:
等效的脚本 API 为 PlayerSettings.scriptingRuntimeVersion 属性。
重要信息:更改此属性需要重新启动 Editor,因为它会影响 Editor 以及播放器。
默认情况下,Unity 行为方式或 .NET 功能的可用性应该不会改变。一旦在项目中使用 .NET 4.6,您就可以在用户脚本和预编译的程序集内使用 C# 6、.NET 4.6 类库和新的运行时功能。
注意:.Net 3.5 脚本运行时已弃用,但可用于 Unity 2018.3 和 2018.4 LTS。请迁移项目或使用 .NET 4.x 运行时创建新项目。
所有平台,但影响方式不同:
启用此选项后,Editor 和 Standalone(独立平台)使用新版本的 Mono。
所有游戏主机平台仅在面向新的 .NET 版本时才能使用 IL2CPP。
iOS 和 WebGL 将继续仅支持 IL2CPP。
Android 将继续同时支持 Mono 和 IL2CPP。
其他平台仍在进行相关工作以便支持新的 Mono 或 IL2CPP
IL2CPP 全面支持新的 .NET 4.6 API 和功能。
新的 Mono/IL2CPP 已通过 Unity 的内部自动化测试。当然,我们预计您仍可能遇到问题。如果遇到任何问题,请提交错误报告。
不包含。这是对类库和运行时的升级,但我们仍在使用 Boehm GC。我们正计划推出与 IL2CPP 结合使用的新版 Boehm(因此 IL2CPP 和 Mono 将具有完全相同的 GC)。
较新的 Mono 垃圾回收器 (SGen) 要求在 Unity 中进行额外的工作,一旦新的运行时和类库稳定后就会跟进。
新的 Mono 需要 VSTU 3.1。请安装此必要版本以便在 Windows 上使用新的 Mono 运行时。
.NET 4.6 类库比我们当前的 .NET 3.5 类库大得多。我们正在积极致力于改进托管链接器以便进一步减小大小。
此外,我们正在开发一个新的 Unity 特有类库 API 配置文件(与我们当前的 unity 配置文件类似),此配置文件将:
a) 专门用于在 AOT 平台上工作
b) 具有更小的外围应用 (surface area),并在内部采用可剥离/可链接的设计
c) 支持 netstandard 2.0(尚待正式发布)
请提交错误报告。我们将迅速修复问题!
2018–08–02 页面已发布但未经编辑审查
从 2018.1 开始,MonoDevelop 由 Visual Studio 取代
在 Unity 2018.3 中已弃用 .Net 3.5 脚本运行时 NewIn20183
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.