This guide applies only to KSP 1.8 and latter. It covers modifying a KSP installation to allow :
- In IDE debugging of KSP plugins by using breakpoints, inspecting runtime variables, doing step-by-step execution, etc. Both Visual Studio (including VS for Mac) and JetBrains Rider support debugging Unity games, and by extension KSP plugins.
- Using the Unity editor profiling tools, which include great tools to measure and analyze CPU/GPU usage and memory allocations.
This guide is extensively tested for a Windows / Visual Studio scenario.
However, it is theoretically possible to make all that work under MacOS or Linux, either with the Rider IDE or Visual Studio for Mac. This guide has limited details about those scenarios. I encourage you to leave a comment if you have additional information / experience.
Modifying KSP for profiling/debugging
Downloading the Unity editor