Can't load win-x64 dll inside UnityPlugin

Issue #47 new
Leonardo Leotte created an issue

Hi! I'm getting this error when trying to load the native lib for windows x64 in Unity:

"Failed to load 'Assets/Plugins/AssimpNet/Native/win/x86_64/assimp.dll', expected x64 architecture, but was Unknown architecture. You must recompile your plugin for x64 architecture."

I've tried changing the "AnyCpu" config to x64 in the AssimpNet project, but the results are the same.

Any tips for this? Thanks!

Comments (4)

  1. Nicholas Woodfield repo owner

    assimp.dll is the native DLL, not the managed one. Make sure you took the native DLL from the correct runtime folder

  2. Leonardo Leotte reporter

    I’m copying the whole “AssimpNet\bin\Release\UnityPlugin\Plugins” into my Unity project, and trying to load the native windows x64 lib from the “Plugins\AssimpNet\Native\win\x86_64” folder. Is that correct?

  3. Lwmte

    Check out which version of assimp.net you’re using. It seems that version 4.1.0 is broken and can’t properly differentiate between 32-bit and 64-bit platforms. We have realized this when lots of users started complaining that different utils in our toolset (all of which are using assimp) are throwing BadImageFormat exceptions because assimp.net is trying to load single assimp.dll at all times.

    There was an undefined timespan when 4.1.0 was available at NuGet but it was delisted and I’ve rollbacked to version 3.3.2. Version 3.3.2 has separate dlls for 32-bit and 64-bit pre-configured, so problem disappeared.

    @Nicholas Woodfield I hope this issue will be fixed in version 5.0.0, should it be released.

  4. Nicholas Woodfield repo owner

    4.1.0 wasn’t delisted

    When getting bad image format exceptions, is this in Unity or completely separate? If not Unity, are you deploying the native runtime folders correctly? For non-Unity cases (since there’s a dedicated Unity script to set probing paths), the library puts much effort into trying to resolve the correct platform and bitness native binary. If you’re hitting a corner case with this logic, please don’t spare the details. And if you have a unique setup, you can always set your own probing paths to resolve wherever you’re deploying the native binaries.

  5. Log in to comment