Unity的Xamarin插件

时间:2016-02-16 22:57:34

标签: c# android plugins unity3d xamarin

我想为Unity创建一个Xamarin Android插件。我能够做这个简单的任务(生成随机数或类似的东西),但是当我试图构建一个更复杂的dll文件并将其用于统一时,Unity中有一些错误。

using UnityEngine;
using System.Collections;
using Plugin;


public class PluginTest : MonoBehaviour
{
    public void CallButton()
    {
        CallAction c = new CallAction ();
        c.Call ();
    }
}

这就是我在Unity中使用它的方式

Internal compiler error. See the console log for more information. output was:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' or one of its dependencies.

File name: 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'

  at (wrapper managed-to-native) System.Reflection.Assembly:InternalGetType (System.Reflection.Module,string,bool,bool)

  at System.Reflection.Assembly.GetType (System.String name, Boolean throwOnError, Boolean ignoreCase) [0x00000] in <filename unknown>:0 

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

  at Mono.CSharp.RootNamespace.GetTypeInAssembly (System.Reflection.Assembly assembly, System.String name) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.RootNamespace.LookupTypeReflection (Mono.CSharp.CompilerContext ctx, System.String name, Location loc, Boolean must_be_unique) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.GlobalRootNamespace.LookupTypeReflection (Mono.CSharp.CompilerContext ctx, System.String name, Location loc, Boolean must_be_unique) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Namespace.LookupType (Mono.CSharp.CompilerContext ctx, System.String name, Location loc) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Namespace.Lookup (Mono.CSharp.CompilerContext ctx, System.String name, Location loc) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.NamespaceEntry.Lookup (System.String name, Location loc, Boolean ignore_cs0104) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.NamespaceEntry.LookupNamespaceOrType (System.String name, Location loc, Boolean ignore_cs0104) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.DeclSpace.LookupNamespaceOrType (System.String name, Location loc, Boolean ignore_cs0104) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.DeclSpace.LookupNamespaceOrType (System.String name, Location loc, Boolean ignore_cs0104) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.MemberCore.LookupNamespaceOrType (System.String name, Location loc, Boolean ignore_cs0104) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Method.LookupNamespaceOrType (System.String name, Location loc, Boolean ignore_cs0104) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.ResolveContext.LookupNamespaceOrType (System.String name, Location loc, Boolean ignore_cs0104) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.SimpleName.ResolveAsTypeStep (IMemberContext ec, Boolean silent) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Expression.ResolveAsBaseTerminal (IMemberContext ec, Boolean silent) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Expression.ResolveAsTypeTerminal (IMemberContext ec, Boolean silent) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Expression.ResolveAsContextualType (IMemberContext rc, Boolean silent) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.LocalInfo.Resolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Block.ResolveMeta (Mono.CSharp.BlockContext ec, Int32 offset) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.ToplevelBlock.ResolveMeta (Mono.CSharp.BlockContext ec, Mono.CSharp.ParametersCompiled ip) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.ToplevelBlock.Resolve (Mono.CSharp.FlowBranching parent, Mono.CSharp.BlockContext rc, Mono.CSharp.ParametersCompiled ip, IMethodData md) [0x00000] in <filename unknown>:0 

这是Unity给我的错误

alter keyspace

甚至可以做我想做的事情吗?如果是这样,我做错了什么?谢谢

0 个答案:

没有答案