简体   繁体   中英

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:

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 :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

The plugin is nothing more than a dll that contains the following

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)

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. 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).

Could not load file or assembly 'System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

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----------

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 ?

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. 1 for unity editor and other for the WP8. For unity editor , set the target platform to .Net 3.5 Hope this will work for you.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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