将托管DLL添加到unity3d

本文关键字:unity3d 添加 DLL | 更新日期: 2024-09-19 13:51:09

我试图实现$p库来识别游戏中的施法手势,但我遇到了一个未处理的异常。我使用的是从他们网站上得到的预编译dll,它是在.Net 4框架中编译的,所以我猜这就是问题的根源。错误如下:

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 
Missing method .ctor in assembly C:'Users'Uri'Desktop'GestureSpell'GestureSpell'Assets'PDollarGestureRecognizer.dll, type System.Runtime.Versioning.TargetFrameworkAttribute
The class System.Runtime.Versioning.TargetFrameworkAttribute could not be loaded, used in PDollarGestureRecognizer
Can't find custom attr constructor image: C:'Users'Uri'Desktop'GestureSpell'GestureSpell'Assets'PDollarGestureRecognizer.dll mtoken: 0x0a00000d

将托管DLL添加到unity3d

您可以尝试在.csproj文件中将true更改为false。这在某些情况下会有所帮助。