【问题标题】:Unity plugin conflict in WP8WP8中的Unity插件冲突
【发布时间】:2014-10-29 04:16:01
【问题描述】:

我试图为 WP8.1 制作一个小插件并将其连接到 unity,但是当我将文件添加到 Asset/Plugins 文件夹时出现反射异常:

内部编译器错误。有关更多信息,请参阅控制台日志。输出是: 未处理的异常:System.Reflection.ReflectionTypeLoadException:无法加载模块中的类。 在(包装器托管到本机) System.Reflection.Assembly:GetTypes (bool) 在 System.Reflection.Assembly.GetTypes () [0x00000] 中:0 在 Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly 程序集,System.Type extensionType) [0x00000] in :0 在 Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in :0 在 Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in :0 在 Mono.CSharp.Driver.LoadReferences () [0x00000] in :0 在 Mono.CSharp.Driver.Compile () [0x00000] in :0 在 Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in :0

插件只不过是一个包含以下内容的dll

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ClassLibrary1
{
    public class Class1
    {
    }
}

在我头疼之后,我开始尝试在一个空项目中添加插件,看看为什么它会给我这个问题。最后,当我删除 Facebook 插件编辑器文件夹时,异常停止了 (资产/Facebook/编辑)

这很奇怪,因为我似乎无法弄清楚为什么该文件夹会以引发反射异常的方式发生冲突。

在进行了更多挖掘后,我发现 Unity 在创建程序集时确实有日志。其中有编译错误,但我似乎无法理解错误。

--CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp-Editor.dll 无法加载从 D:\Backup_Projects\game\Assets\Plugins\LocalSaveFile.dll 引用的以下程序集: 程序集:System.Runtime (assemblyref_index=0) 版本:4.0.10.0 公钥:b03f5f7f11d50a3a 在全局程序集缓存、MONO_PATH 环境变量中列出的路径或执行程序集的位置 (D:\Backup_Projects\game\Assets\Plugins) 中找不到程序集。

无法加载文件或程序集“System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一。

程序集 D:\Backup_Projects\game\Assets\Plugins\LocalSaveFile.dll 中缺少方法 .ctor,键入 System.Runtime.CompilerServices.RuntimeCompatibilityAttribute 找不到自定义 attr 构造函数图像:D:\Backup_Projects\game\Assets\Plugins\LocalSaveFile.dll mtoken: 0x0a00000f -----编译器输出:-stderr---------

我想知道是不是因为 Visual Studio 2013 和 .Net 框架版本... Unty 应该是 .2 但 .net 2013 是 4.5?

但是,到目前为止,我非常非常非常迷茫。我不知道为什么会发生这个错误。

我们将不胜感激。

【问题讨论】:

    标签: c# .net visual-studio-2013 unity3d


    【解决方案1】:

    您需要制作两个 DLL 文件。 1 用于统一编辑器,其他用于 WP8。 对于统一编辑器,将目标平台设置为 .Net 3.5 希望这对你有用。

    http://docs.unity3d.com/Manual/wp8-plugins-guide-csharp.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-14
      • 2020-07-14
      • 2012-08-20
      • 1970-01-01
      相关资源
      最近更新 更多