Many people are writing reusable code components in external DLL files, and deploy them in their Unity project. Using UnityVS, it's also possible to debug them.
Please note that UnityVS currently only supports debugging managed DLLs. Native C++ DLLs are not supported yet.
Add your projects to the UnityVS solution
In Visual Studio, you can add an existing project to the UnityVS generated solution. Starting from UnityVS 1.2, the external project reference will be maintained, even when UnityVS has to regenerate the project files.
Reference the proper Unity framework profile
In Visual Studio, you can change the properties of your class library to target a Unity profile, so you don't risk calling methods that exist in .net 3.5, but that are not in the Mono version that Unity uses. Use the one that maps the level of API compatibily that your project targets.
Copy the DLL to Unity's Assets folder
There's two ways to do this. You can either:
- Directly set the output folder of the project to a folder in the Assets folder of your Unity project.
- Modify your class library projects to add a MSBuild post build task to copy the output DLL in the Assets folder of your Unity project.
Debug your code
You can now put breakpoints in your DLL code in the UnityVS solution, and start the debugger.