DllNotFoundException in unity3d plugin for c++ dll

后端 未结 7 1500
死守一世寂寞
死守一世寂寞 2021-01-11 17:49

I am working on the Unity Plugin project and try to import the c++ native dll from c# file. But I keep getting dllnotfoundexception.

c++ dll code:

7条回答
  •  不知归路
    2021-01-11 18:37

    Make sure the following chacklist is satisfied:

    • Plugins should all stay in a folder called Plugins.
    • The architecture your dll is built for (x86 or x86_64) must correspond to the architecture version of Unity Editor. Unity Editor 32-bit will not load 64 bit plugins and viceversa.
    • If you are targeting both 32 and 64 bit architectures you should put your dlls in special named folders inside the Plugins folder. The names are Plugins/x86 for 32 bit dlls and Plugins/x86_64 (x64 also works) for 64 bit dlls.
    • Visual C++ Redistributables must be installed. I have all from 2008.
    • When you build all your dlls should be copied into the root where your executable is (and again built for the correct x86/x64 architecture)

    If you keep getting a namespace error it means the dll you are importing has unmanaged code and it must be wrapped into another managed dll Pugin in order to work.

    These threads are a bit outdated but still relevant

    DLLNotFoundException - Unity3D Plugin

    Unity internal compiler error with custom dll

提交回复
热议问题