Getting Started
Let's take Godot for a walk!
Learn how to embed your new or existing Godot project into a .NET application!
Before You Grab the Leash
To get set up, you'll need:
- .NET SDK 10.0 or later
- A supported platform to develop on:
win-x64,linux-x64, orosx-arm64 - The Godot 4.7.x .NET editor for normal game authoring (builds and CI do not require it)
Trail marker
With 2dog, the same C# Godot project runs through desktop, test, and browser hosts. It does not create a second game or port scripts to another language. GDScript, autoloads, input actions, and the rest of Godot still work. Same dog, new leash.
1. Choose Your Starting Point
Add hosts around an existing project, or start fresh:
# Existing game content stays where it is.
cd path/to/MyGame
dnx 2dog add# Create the Godot project and its hosts together.
dnx 2dog new MyGame
cd MyGameThe tool asks which hosts you want and shows its plan before making changes. Flags skip the prompts; for example, dnx 2dog new MyGame --desktop --tests --web.
Try before you bite?
Use dnx 2dog add path/to/MyGame --dry-run to inspect every planned action. Adding 2dog to a Project documents what the command creates and patches.
2. Run the Generic Host
dotnet run --project MyGame.2dogMyGame.2dog is the process entry point and starts Godot as an embedded library. It runs as a generic .NET console application, which you may change and extend as you wish.
3. Meet the Pack
The Godot project is also the solution root. The generated layout starts like this:
MyGame/ Godot project and solution root
├── MyGame.2dog/ Generic host
├── MyGame.tests/ xUnit host
└── MyGame.web/ Browser hostYour scenes, scripts, and assets remain at the root. See Project Layout for the complete tree and each project's responsibilities.
4. Keep Using Godot
Open the same project root in the Godot .NET editor:
godot-mono --editor . # or Godot_v4.7.1-stable_mono_win64.exe, etc.Edit scenes and C# scripts as usual. Builds detect changed project inputs and run the required resource import automatically. See Resource Import for how it works and how to configure it.
Trail marker
You now have two compatible ways into the same project: the Godot editor for authoring and the .NET hosts for running, testing, and publishing.
5. Run the Tests
Projects scaffolded by 2dog include a headless xUnit host by default:
dotnet test MyGame.testsThis starts Godot without a window and runs tests through the normal .NET test runner. See Testing with xUnit to load scenes and test game behavior, and Single Godot Instance for parallelism constraints.
6. Publish to the Browser
Install the WebAssembly build tools and a static file server once:
dotnet workload install wasm-tools
dotnet tool install --global dotnet-serveThen publish the web host:
dotnet publish MyGame.webThe static site is written to MyGame.web/AppBundle/. Serve that directory with any static file server; for example:
dotnet serve --directory MyGame.web/AppBundleTrail marker
The Web / Browser guide covers the development loop, deployment, configuration, and current browser limitations.