I have a rather huge project, and wish to move some code into a DLL. Normally, when using VS I will just create a standalone library and add reference to it. Are there any extra steps to go through for a unity project?
I could not figure it out with Mono so I compile mine with Visual Studio (even Express):
- Create a project
- Right-click solution and add new project
- Choose ClassLibrary, give it a name and a location
- Copy paste your code from your script onto that library file
- Right click and Build.
Now find the folder you created on step 3. If you did not specify any path it will be into the main project folder. Open it, open bin file and finally Release. Copy Paste the dll file onto your Asset folder of your Unity game.
Now back in Mono Develop, right click on References in the solution panel, then Edit References.
The new library should probably appeared in the Selected references on the right. If not select .NET assembly and find it in your asset folder. Then press ok.
You should see it listed in your references and you can ad it with
using LibName;
Hopefully I did not forget anything…