forked from YCLiang95/RPG-Style-Inventory-CE-Ducttape-Fix
-
-
Notifications
You must be signed in to change notification settings - Fork 10
How to debug RimWorld from Visual Studio
Mhburg edited this page Apr 18, 2020
·
15 revisions
Environment: Visual Studio Community 2019+, Unity Tools for Visual Studio
- Install Visual Studio Community 2019 or better and choose workload for developing with Unity. If VS is already installed, please refer to Visual Studio tool for Unity
- Download Unity-debugging-2019.x.zip from dnSpy. More information can be found on its wiki.
- Backup RimWorld folder. More specifically, backup the dll below,
π---Installation_path_of_RimWorld
| π---RimWorld
| π---MonoBleedingEdge
| π---EmbedRuntime
| βοΈ---mono-2.0-bdwgc.dll
- Unzip the file from dnSpy, copy the
mono-2.0-bdwgc.dll
in folderunity-2019.1.8
or newer version and drop it in the directory in step 3 to replace the vanilla one. - Add RimWorld.exe as an existing project to solution as such.
-
Right click on the added RimWorld.exe and add environment variable
Variable=dnspy_unity_dbg2, Value=--debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:56000,suspend=y,no-hide-debugger. And set it as the startup project via the right-click context menu. - Update the build information of your project and have it produce "Portable" debugging information. Example
- Almost there. Now, build the solution, start it without debugging. The default hotkey is "Ctrl+F5". And nothing will happen until a unity debugger is attached. Press "Attach Unity Debugger", click "Input IP" on the pop up window and "OK". RimWorld now will spin up with a debugger attached. Example
- Don't forget to build your solution and copy the pdb files along with the dll files to mod folders.