在通用 Windows 平台的 Player 设置窗口的 Publishing Settings 面板下,有一个名为 Compilation overrides 的下拉菜单。此处提供了 3 种设置:
值 | 功能 |
---|---|
无 | Unity 使用 Mono C# 编译器编译所有 C# 脚本。 |
Use Net Core Partially | Unity 使用 Mono C# 编译器编译文件夹 Assets/Plugins 、Assets/Standard Assets 和 Assets/Pro Standard Assets 中的脚本,并使用 Microsoft C# 编译器编译其余的脚本。 |
Use Net Core | Unity 使用 Microsoft C# 编译器编译所有脚本。 |
两种编译器都有优缺点。使用 Mono C# 编译器编译脚本将允许 JavaScript 脚本引用这些脚本,例如,Angry Bots 需要这种编译方式(因此必须将其设置为 None)。但是,使用 Microsoft C# 编译器将允许使用特定于 Microsoft 的 API 而无需插件,只需将代码包装在 #if ENABLE_WINMD_SUPPORT/#endif 中,便会编译并正常工作。
可在 <user>\AppData\Local\Microsoft\AppCertKit
中找到一个日志,其中可能包含有关失败的其他信息。
别担心。全部都在这里:
UNITY_WINRT | Defined on all scripts |
UNITY_WSA | Defined on all scripts |
UNITY_WINRT_10_0 | Defined on all scripts |
UNITY_WSA_10_0 | Defined on all scripts |
ENABLE_DOTNET | Defined on all scripts when using .NET scripting backend |
ENABLE_IL2CPP | Defined on all scripts when using IL2CPP scripting backend |
NETFX_CORE | Defined on C# scripts that are compiled using Microsoft C# compiler when using .NET scripting backend |
WINDOWS_UWP | Defined on C# scripts that are compiled using Microsoft C# compiler when using .NET scripting backend or IL2CPP scripting backend with .NET 4.6 compatibility level |
ENABLE_WINMD_SUPPORT | Defined on C# scripts that are compiled using Microsoft C# compiler when using .NET scripting backend or IL2CPP scripting backend with .NET 4.6 compatibility level |
另请参阅依赖于平台的编译。
可能有几个原因:
• 2017–05–16 页面已修订但未经编辑审查
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.