DLLNotFoundException - Unity3D Plugin

I get DLLNotFoundException in standalone builds on some windows machines, others work fine. The Dll file is definitely located in the plugins folder, I copied it to the projectName_Data folder too, but no difference.

Also tried adding a dll to the streaming resources folder and setting a new path (Environment.SetEnvironmentVariable) as above, but that didn't work either.

Using Unity 4.5.5 btw

Any help at all would be greatly appreciated.

DLLNotFoundException

+3
source share
2 answers

I found that the problem was that players needed to install Visual C ++ redistributable, which can be downloaded here: https://www.microsoft.com/en-gb/download/details.aspx?id=40784

0
source

I found that a DllNotFoundException error in some cases is very misleading. Unity is not to blame for this, because when something goes wrong with loading the dll, Unity simply does not have this DLL in memory and tells you about it.

As Keysosaurus says, Visual C ++ Redistributable must be installed for your standalone version to work, and in most cases this solves the problem, but there may be other reasons, such as third-party dependencies.

If you use third-party libraries, then you must also copy all the necessary DLLs or SOs to your executable folder.

For example, I work with OpenNI 2, and when I create, I immediately copy all the files from the C: \ Program Files (x86) \ OpenNI2 \ Redist folder to the folder containing the .exe file. This does not throw a DllNotFoundException.

Also remember that the DLLs (and SOs) must match the architecture you are aiming at, so if you are targeting x64 (64-bit), then your DLL should also be x64, and if you try to use x86 (32-bit) The Unity DLL will be confused and will not load, which will give you the same error.

As a note, keep in mind that Unity 5 ships in both 32 and 64-bit versions. To run your game in the Unity Editor, all third-party libraries must be present in both x86 and x64 (in the usual Unity folders), or at least one that matches your Unity Editor architecture.

+1
source

All Articles