简体   繁体   English

WP8中的Unity插件冲突

[英]Unity plugin conflict in WP8

I was trying to make a small plugin for WP8.1 and conect it to unity, but i get a Reflection Exception when i add the file to the Asset/Plugins folder: 我试图为WP8.1制作一个小插件并将其连接为一体,但是当我将该文件添加到Asset / Plugins文件夹时,我收到反射异常:

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. 输出为:未处理的异常:System.Reflection.ReflectionTypeLoadException:无法加载模块中的类。 at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool) at System.Reflection.Assembly.GetTypes () [0x00000] in :0 at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in :0 at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in :0 at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in :0 at Mono.CSharp.Driver.LoadReferences () [0x00000] in :0 at Mono.CSharp.Driver.Compile () [0x00000] in :0 at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in :0 在(包装器托管到本机)System.Reflection.Assembly:GetTypes(bool)在System.Reflection.Assembly.GetTypes()[0x00000]在Mono.CSharp.RootNamespace.ComputeNamespaces(System.Reflection.Assembly程序集:0处) ,在Mono.CSharp.RootNamespace.ComputeNamespace处为0的System.Type extensionType)[0x00000](Mono.CSharp.CompilerContext ctx,在Mono.CSharp.GlobalRootNamespace.ComputeNamespaces处为0的System.Type extensionType)[0x00000]。 CSharp.CompilerContext ctx)在Mono.CSharp.Driver.LoadReferences中的:0处的[0x00000](0 [00000x00000]在Mono.CSharp.Driver处的:0处的Mono.CSharp.Driver.Compile()[0x00000]中的[0x00000]。 :0中的Main(System.String [] args)[0x00000]

The plugin is nothing more than a dll that contains the following 该插件只不过是一个包含以下内容的dll

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

namespace ClassLibrary1
{
    public class Class1
    {
    }
}

After much breaking my head i moved started trying to add the plugins in an empty project to see why it was giving my this problem. 经过一番挣扎之后,我开始尝试在一个空项目中添加插件,以查看为什么它给了我这个问题。 Fially the exception stoped when i removed the Facebook plugins Editor folder (Assets/Facebook/Editor) 最后,当我删除了Facebook插件编辑器文件夹(资产/ Facebook /编辑器)时,异常停止了

This is very odd since i cant seem to figure out why that folder would conflic in a way that would raise a Reflection Exception. 这很奇怪,因为我似乎无法弄清楚为什么该文件夹会以引发反射异常的方式发生冲突。

After doing some more diggin i found out that Unity does have logs when creating the assemblies. 经过多番研究之后,我发现Unity在创建程序集时确实有日志。 In it there was the compile error but i cant seem to understand the error. 在其中有编译错误,但我似乎无法理解该错误。

-----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp-Editor.dll The following assembly referenced from D:\\Backup_Projects\\game\\Assets\\Plugins\\LocalSaveFile.dll could not be loaded: Assembly: System.Runtime (assemblyref_index=0) Version: 4.0.10.0 Public Key: b03f5f7f11d50a3a The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (D:\\Backup_Projects\\game\\Assets\\Plugins). ----- 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)。

Could not load file or assembly 'System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. 无法加载文件或程序集'System.Runtime,版本= 4.0.10.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一。

Missing method .ctor in assembly D:\\Backup_Projects\\game\\Assets\\Plugins\\LocalSaveFile.dll, type System.Runtime.CompilerServices.RuntimeCompatibilityAttribute Can't find custom attr constructor image: D:\\Backup_Projects\\game\\Assets\\Plugins\\LocalSaveFile.dll mtoken: 0x0a00000f -----CompilerOutput:-stderr---------- 程序集D:\\ Backup_Projects \\ game \\ Assets \\ Plugins \\ LocalSaveFile.dll中缺少方法.ctor,键入System.Runtime.CompilerServices.RuntimeCompatibilityAttribute找不到自定义属性构造函数图像:D:\\ Backup_Projects \\ game \\ Assets \\ Plugins \\ LocalSaveFile .dll mtoken:0x0a00000f -----编译器输出:-stderr ----------

I wonder if its because of visual studio 2013 and the .Net framework version... Unty is supposed to be .2 but .net 2013 is 4.5 ? 我想知道是否是因为Visual Studio 2013和.Net Framework版本... Unty应该是.2但.net 2013是4.5吗?

But, as of now i am very very very lost. 但是,到目前为止,我非常非常迷失。 I have no idea why this error really happens. 我不知道为什么这个错误真正发生。

Any guidance will be much apreciated. 任何指导都将非常重要。

You need to Make two DLL files. 您需要制作两个DLL文件。 1 for unity editor and other for the WP8. 1用于统一编辑器,其他用于WP8。 For unity editor , set the target platform to .Net 3.5 Hope this will work for you. 对于统一编辑器,请将目标平台设置为.Net 3.5,希望这对您有用。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM