I’m getting a System.DllNotFoundException when I do Build and Run from Unity. The project runs perfectly well in the editor. I have the build set correctly to 64-bit and have verified that the DLL it’s trying to load is also 64-bit.
When I get the error, it claims it was unable to load the DLL from the path that I can verify visually that it copied the DLL to, it’s just not finding it, it seems.
The DLL in question is a native DLL loaded from a managed DLL. It may have dependency on other native DLLs which are being copied (correctly?) to the Plugins directory of the built executable’s *_Data folder.
It seems that if we move all the DLLs from the Plugins folder into the root directory of the executable that things start working again. Shouldn’t Unity be able to load DLLs from the directory it puts them into? Or what am I missing?
Errors are:
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/.\C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper-x64.dll
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/.\C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper-x64
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/libC:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper-x64.dll
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/.\libC:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper-x64.dll
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/libC:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper-x64.dll
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/.\C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper-x64.dll
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/.\C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper-x64
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/libC:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper-x64.dll
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/.\libC:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper-x64.dll
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/libC:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper-x64.dll
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/.\C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper.dll
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/.\C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/libC:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper.dll
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/.\libC:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper.dll
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/libC:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper.dll
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/.\C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper.dll
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/.\C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/libC:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper.dll
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/.\libC:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper.dll
Fallback handler could not load library C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Mono/libC:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper.dll
Unable to initialize library due to: System.DllNotFoundException: C:/Users/scott/Desktop/Test Alpha SDK Build_Data/Plugins/DllWrapper.dll