gpt4 book ai didi

c# - 自定义 dll 的 Unity 内部编译器错误

转载 作者:搜寻专家 更新时间:2023-10-31 01:05:35 25 4
gpt4 key购买 nike

我花了几个小时尝试在网上找到的解决方案,但没有任何效果,所以这是我对 Stackoverflowers 的问题。

我为 Unity 制作了一个小插件,并将 dll 导入到我的项目文件夹中。当我在编辑器中启动游戏时,它工作正常,但如果我尝试编译,我会得到以下信息:

Internal compiler error. See the console log for more information. output was:
Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)

at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0

at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0

at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0

at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0

at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0

at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0

at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0

到目前为止我做了什么:

  • 我的 dll 在 Assets 的 Plugins 文件夹中
  • 尝试将 dll(也)放在项目根目录中
  • 尝试使用和不使用 namespace
  • 在 Unity 中设置 .NET 2.0

顺便说一下,它在 Unity Editor 中运行良好,所以应该很清楚我按照官方插件制作指南中的说明做对了。

感谢您的帮助

最佳答案

当我从 Plugins 文件夹中删除 dll 而只在项目的根文件夹中保留它的拷贝时,它起作用了

因此在这种情况下,解决方案是将 dll 保留在项目的根文件夹中,而不是其他地方。

我不确定为什么,所以部分问题仍然悬而未决。

关于c# - 自定义 dll 的 Unity 内部编译器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22386343/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com