1
\$\begingroup\$

I'm developing a dll that is to be used in two Unity projects.

I've read that the way to reference a dll is to drag it into a 'plugins' folder so that it is added to the Unity project's dependencies, as their is no "add reference" available for this project in Visual Studio.

But doing that the Unity project does not take into account that the dll evolves (as it is still in development).

What I'd like (if possible) is to set up an automatic way so that the Unity projects update their dependencies when the shared dll is updated.

I've try the reimport option (right click on the dll in Unity) but it seems that it is not working.

What is the best way to manage this situation?

\$\endgroup\$
1
\$\begingroup\$

You can edit the msbuild config of the dll to have it automatically be placed in the plugins folder on compilation. InfallibleCode has a video on this somewhere on YouTube

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Yes thanks. This is what I've finally done (in the past... was in 2018 ; ) \$\endgroup\$
    – lemon
    Nov 22 '20 at 8:22
2
\$\begingroup\$

It seems like less an issue with Unity, more one with Mono not handling updated dlls very well. It's been discussed on Unity Answers.

It looks like the two options for solving this are:

1) Restart Unity each time a dll is updated 2) Implement a wrapper around your library that uses LoadLibrary/GetProcAddress instead of DllImport

\$\endgroup\$
1
  • \$\begingroup\$ thanks. fyi I've received an answer here stackoverflow.com/questions/48961693/…. It is not perfect as compiling the dll is required each time you want to use dll new features in the Unity project, but it is easy enough as there is no better answer in my opinion for now. \$\endgroup\$
    – lemon
    Feb 26 '18 at 12:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .