Debugger and utilities for working with Godot C# projects in VSCode.
Requirements
Godot 3.2.2 or greater. Older versions of Godot are not supported.
Features
- Debugging.
- Launch a game directly in the Godot editor from VSCode.
- Additional code completion for Node paths, Input actions, Resource paths, Scene paths and Signal names.
NOTES:
- A running Godot instance must be editing the project in order for
Play in Editor
and the code completion to work.
- Node path suggestions are provided from the currently edited scene in the Godot editor.
- Currently Signal suggestions are only provided using the information from the project build
results, not from the information in the edited document. This will change in the future.
VSCode installation and configuration
Install via extensions marketplace by searching for neikeq.godot-csharp-vscode
.
Multiple Project setup
If the current workspace contains multiple Godot projects, the extension will prompt you to select the one you want to use with the extension on opening the workspace in VSCode. The selected project can be changed anytime from the status bar or using the Select Project
command.
Setup debugging
To debug a Godot project you have to create the debugger launch configurations. It can be created from the Debug panel or by using the Generate Assets for Build and Debug
command.
Additional Launch
configuration
The Launch
debugger configurations requires additional setup. The "executable" property must be set to a path that points to the Godot executable that will be launched. By default, the extension tries to automatically populate this property with the path to the running Godot instance but if there isn't one it needs to be set manually:
You can also set the godot.csharp.executablePath
setting to the path that points to the Godot executable that will always be used when generating the debugger configurations so you won't have to set it manually everytime.
The generated debugger configuration will also create a tasks.json
that contains a build task for building the project from VSCode which is used by the Launch
configuration in order to build the project before launching (this is configured in the "preLaunchTask" property of the configuration and can be removed).
The build task uses the Godot executable to build the the C# project (this is configured in the "command" property and must be configured like the "executable" property of the Launch
configuration if the extension could not find the right path). The build task can be modified to execute the dotnet
command directly instead or modify the Godot CLI arguments.
Debugger launch configurations
By default the extension creates the following launch configurations:
- Play in Editor
Launches the game in the Godot editor for debugging in VSCode.
For this option to work, a running Godot instance must be editing the project.
- Launch
Launches the game with a Godot executable for debugging in VSCode.
This option requires the value of the "executable" property to be set to
a path that points to the Godot executable that will be launched.
The godot.csharp.executablePath
setting can be configured to automatically populate the
executable property with its value, if not configured it will be populated with the path
to the running Godot instance if there is one, otherwise it will have to be populated manually.
See additional Launch
configuration.
- Launch (Select Scene)
Launches the game with a Godot executable for debugging in VSCode, allowing the user
to select which scene to run on every execution.
This option works just like the Launch
option and also requires the value
of the "executable" property to be set.
See additional Launch
configuration.
- Attach
Attaches to a running Godot instance that was configured to listen for a debugger connection.
Screenshots