Darius Foo

Godot + C# + VSCode (macOS)

Install system dependencies:

brew install --cask mono-mdk dotnet-sdk godot-mono
brew install mono
$ which dotnet msbuild mono

Start Godot and create a project (e.g. $HOME/godot/hello).

Add a C# script to a node. This should generate hello.sln and hello.csproj files.

Set Editor > Editor Settings > Mono > Editor, so VSCode will be started when double-clicking script files.

Over to VSCode. Install the following extensions:

Open the project:

code $HOME/godot/hello

Uncheck OmniSharp: Use Modern Net or add this to your settings.

"omnisharp.useModernNet": false

Follow the prompts to restart OmniSharp.

At this point, IntelliSense should work for standard types and namespaces, e.g. List and System.Collections.Generic. If it doesn't, open the Output view and look at the C# and OmniSharp Log sections, and try to fix the errors there.

Once basic IntelliSense is working, start Godot in a separate terminal.1

/Applications/Godot_mono.app/Contents/MacOS/Godot --path "$HOME/godot/hello" -e

Click Build in the top-right corner.

Switch back to VSCode, Restart OmniSharp, and IntelliSense should work for Godot APIs like GD.Print.2

Debugging seems to just work. Select View: Show Run and Debug and click Play in Editor on the left.

Other resources:

  1. Godot invokes msbuild, so this is just to ensure it is started in the appropriate environment. Alternatively, select Godot Tools: Open workspace with Godot editor from the command palette after configuring the path to the editor in the workspace settings.json, and this will be done for you in a terminal in VSCode.

    "godot_tools.editor_path": "/Applications/Godot_mono.app/Contents/MacOS/Godot"
  2. In the status bar, you should see a flame icon indicating "OmniSharp server is running", and a "Connected" section indicating the GDScript language server (provided by Godot itself) is running. ↩︎