Background info (might be relevant):
I have a Unity project that makes direct use of a third-party DLL ("library A"), which I've added to the project's Assets folder. Library A depends on another DLL, "library B", which I've also added to the Assets folder. Library B is not used by any scripts in the Unity project. Both libraries A and B are written in C# and target .NET 4, i.e., they're both managed code.
Once added to the Assets folder, both libraries A and B are listed under "References" when the project is opened in Visual Studio and "Copy Local" is set to "True" for both (although I don't know if Unity uses that property).
However, when running the project in the Unity editor, various calls to library A raise exceptions that indicate that library B isn't available. The only way I've been able to get it to work is by placing a copy of library B in C:\Program Files\Unity\Editor
(the directory containing Unity.exe, the Unity editor executable).
I've used libraries A and B in other, non-Unity projects and never had any issues (Visual Studio copies them both to the output directory as long as they're referenced). Am I missing a Unity-specific step that's necessary to tell it that library B is required?
I ran into this same issue today, and here's what fixed it for me: In the Unity editor, navigate to where the library B is located, select the library, and on the Inspector window under "Plugin load settings", enable the "Load on startup" checkbox. I suppose this is needed because no Unity scripts are directly calling library B.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With