I have a problem that's been hunting me for weeks.
I have the following setup :
Where both the Server and Client use the Shared library.
Right now, I manually build and copy the shared.dll to the Assets folder of the Unity project.
I find it really cumbersome. I'm looking for an automatic way and I did some research and learned that since Unity rebuilds the project file, you can't link a project to it because it will automatically get deleted on rebuild.
My question is : How do I link an external Project to Unity?
There are two ways that I am aware of.
The first and simplest is to use Microsoft's MSBuildForUnity (which was created after the original post) https://github.com/microsoft/MSBuildForUnity/blob/master/Samples/IntegratedDependencies.Unity/README.md which is build for this very purpose.
The alternative (which was possible at the time of the original post) is to use the undocumented process of creating a subclass of AssetPostprocessor
and create the function private static string OnGeneratedSlnSolution(string path, string content)
to manually manipulate the sln
file that Unity will generate to include your references to your shared library.
This way, each time that Unity recreated the sln
file, it will now also include your reference. The down-side is that the content comes in as a String
so you may want to parse it through more libraries to make sure that you have a valid result or make your solution very rigid.
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