After pull request #19201 attached debugging is now working on all supported platforms. The issues that had been stopping debugging on windows have been fixed and we can now set breakpoints, inspect variables, and step through code to our hearts content.
Currently this requires a recent build from master branch, or 3.0.3+.
1. Install VS Code extension:
- Click on the Extensions icon in the activities bar (left had side).
- Search for and install the Mono Debug extension.
- Close VS Code (some elements will appear only after restarting the application).
2. Configure your project using the Godot Editor:
Wait for Debugger.
- While on the
Debugger Agentpage note the value specified for
- Optionally change the
Wait Timeoutto a larger value (this will give you more time when performing step 4.3 below).
3. Configure your project using VS Code:
- Drop-down menu:
- This will create and open your project’s
launch.jsonfile. Ensure the profile named
Attachhas the correct port from step 2.2 above.
- Click on the debug icon on the activities bar (left hand side) then select
Attachfrom the configuration pull-down (top).
- If your project has been created by a Godot version before #18949 (this applies to all official releases before 3.0.3) then edit your project’s
.csprojfile so that all instances of
<DebugType>full</DebugType>are changed to
4. Start debugging:
- Apply a breakpoint to an interesting location using VS Code.
- Start your project using the Godot Editor.
- Switch to the VS Code application and “Start Debugging” either with the
F5key, the green play button on the debugger activity panel or the Debug drop-down menu.
For subsequent debuging sessions on the same project you can simply repeat step 4, but for new projects you will have to start from step 2. To restore normal behaviour for your project you will need to toggle
Wait for Debugger from 2.1 above.
You may also enjoy: