Unity DEBUG DLL(C#)

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.
To be able to debug the DLL, the debugger also needs debugging symbols, mapping code locations to source files. When you create a DLL with Visual Studio, it outputs the debugging symbols in a PDB file. For UnityVS to be able to debug your DLL, you must copy the PDB file along. The UnityVS package will use the information from the DLL and the PDB to create a .DLL.MDB file that is the debug symbol format used by Unity's scripting engine.

Debug your code

You can now put breakpoints in your DLL code in the UnityVS solution, and start the debugger.


From:http://unityvs.com/documentation/dll-debugging/

發佈了228 篇原創文章 · 獲贊 49 · 訪問量 48萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章