c# - Unity - 为什么我看不到当前的脚本运行时/API 兼容级别选项?

标签 c# unity3d

我使用的是 Unity 2018.2.6f1(几天前刚刚更新),在此之前,我使用的是 Unity 2018.2.5。我正在尝试导入 .Net Standard 2.0 类库,但出现错误

Project ... targets 'netstandard2.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v3.5'.

我不知道如何将我的 Unity 项目更改为以 .Net Standard 2.0 为目标。

This question seems to ask the same thing ,但我无法遵循已接受的答案,因为较新的选项不会显示在脚本运行时版本或 Api 兼容性级别的播放器设置中。在我的 Unity 版本中,脚本运行时版本的唯一选项是 .NET 3.5 Equivalent 或 .NET 4.x Equivalent,Api Compatibility Level 的唯一选项是 .NET 2.0 和 .NET 2.0 Subset。

The Unity documentation还引用了我看不到的选项 - 如果我可以将项目设置为 .Net Standard 2.0,它说我应该能够引用类库而无需额外的步骤,但我还是被困在如何改变我的项目到那个。根据我发布的链接,我应该会看到新的 .NET4.6 选项以及 .Net Standard 2.0,但我的安装中肯定遗漏了一些东西。感谢任何有关更改目标的帮助!

最佳答案

我终于明白了。将脚本运行时版本设置为 .NET 3.5 Equivalent,Api Compatibility Level 的选项为 .NET 2.0 Subset.NET 2.0。将 Scripting Runtime Version 更改为 .NET 4.x Equivalent 并重新启动编辑器后,您可以看到 .Net 4.x 的新 Api Compatibility Level 选项.Net Standard 2.0 和其他选项消失。

关于c# - Unity - 为什么我看不到当前的脚本运行时/API 兼容级别选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52172932/

相关文章:

c# - 如何将Connection String中的 "Provider Name"添加到Context文件中?

c# - 请帮助我使这段代码线程安全

c# - 使用 iTextSharp 5.3.3 和 USB token 签署 PDF

c# - 我应该仅使用事件聚合器来防止内存泄漏吗?

c# - 仅跟踪 HTC Controller 而不跟踪耳机本身

c# - 统一 3D : Footstep sounds looping the first few milliseconds instead of playing the full sound then looping

c# - 将表达式<Func<T1>> 转换为表达式<Func<T1, T2>>

c# - JetBrains Rider 建议 "make parameter type Component"。为什么?

unity3d - 在不加入 channel 的情况下在Unity中播放音频效果?

database - Sqlite数据库+unity