ShotgunNinja / Kerbalism

Hundreds of Kerbals were killed in the making of this mod.
The Unlicense
43 stars 19 forks source link

UnityVS and Monodevelop debugging #99

Closed PiezPiedPy closed 7 years ago

PiezPiedPy commented 7 years ago

Visual Studio project files and tools for UnityVS and Monodevelop debugging, uses the Post build event to start a script to create the .mdb files.

See: http://forum.kerbalspaceprogram.com/index.php?/topic/102909-ksp-plugin-debugging-for-visual-studio-and-monodevelop-on-all-os/&page=1

For debugging KSP with Visual Studio and Unity you will need to download and install the Unity Editor version 5.4.0 from https://unity3d.com/get-unity/download/archive and the patch 5.4.0p4 from https://unity3d.com/unity/qa/patch-releases?version=5.4&page=4 you will also need the UnityVS extension, use the Visual Studio extension manager window to download and install it.

In the Unity install directory there is a "Unity\Editor\Data\PlaybackEngines\windowsstandalonesupport\Variations\win64_development_mono" sub-directory. Copy the "player_win.exe" and "player_win_development_x64.pdb" files found there to your KSP dev install (next to KSP.exe) Rename "player_win.exe" to "KSP_x64_Dbg.exe" Create a junction "KSP_x64_Dbg_Data" linking to "KSP_x64_Data" Download this file https://www.sarbian.com/sarbian/PlayerConnectionConfigFile and put it in the "KSP_x64_Data" directory.

Starting a debugging session in VS will launch KSP, don't forget to attach to the process with "Attach Unity Debugger" in the Debug menu

Note: You will need to change VS project properties->Build startup exe's

ShotgunNinja commented 7 years ago

I will not merge it because:

I will remove the existing project file to avoid confusion in future. Everybody is expected to set up its project structure, IDE, postbuild scripts and debugging facilities as he deem fit.

If you want to not waste this amount of work, maybe you could create a guide (in markdown syntax, use gist) and some attachments for it (the build scripts, the debug symbol generator, 7z, etcetera). I will then gladly create an ad-hoc section in the wiki and include your guide, and host your attachments in the misc/ folder.

ShotgunNinja commented 7 years ago

Also maybe relevant: there is a simple 'frame-based' profiler included in the code base here, that is appropriate for performance measurements.

PiezPiedPy commented 7 years ago

Moved to PR #107 Kerbalism, Visual Studio and Unity