An opinionated quick-start template for Godot projects using C# and aiming not to deliver games, but rich desktop applications.
- A C# ready setup.
- A unit-test C# project is included.
- A directory and namespace structure that promotes a separation of the presentation and business layers.
- All presentation logic is what's happening inside of Godot's systems. Godot artifacts are separated by type by default and bundled together when reasonable. For example, components are structured so as to be as self-contained as possible.
- All actual business logic is to be handled by C#.
- An input validation framework, with working examples.
- A data source framework, with working example.
- This is a suggestion for how to read and write data from and to disk.
- The 'Roboto' Google font. All credit goes to their respective owners. Its license is contained in the font's directory.
While this project is designed to include most of the necessary parts for a running start, it cannot provide all the pieces.
- Make sure to have read and understood the official Godot tutorial: https://docs.godotengine.org/en/stable/tutorials/scripting/c_sharp/c_sharp_basics.html
- This project requires the .NET Framework v4.7.2 to run.
- This project has been set up with the
Godot_v3.5.1-stable_mono_win64
Godot binaries.- The exact version shouldn't matter, but in case you run into odd issues not outlined here, make sure to test it with this exact version also.
- In case you're not working with Visual Studio, you may need to invoke NuGet manually, to get any required dependencies downloaded.
After having cloned this repository, you should be able to build and run the project right away. Then, make it your own:
- Change out the
app/icon.png
image for your own. - Change the name of the project to your own. For that, in Godot, navigate to
Project > Project Settings > Application > config
and change the name to your preference. Be mindful that changing the name affects several other things in Godot, such as the name of the user-specific data directory. - If you're working with Visual Studio, the solution file can be found in
app
and is calledapp.sln
. - Write your model of business data, inside the
app/business/model
directory and integrate your model into theapp/business/state/ApplicationState.cs
class. - Define the application-level settings as fields inside the
app/business/state/ApplicationSettings.cs
class.
- Due to how Godot automatically adds the contents of the Godot project to the Godot associated C# project, it is best practice to avoid adding C# sub-projects within the directory structure of the Godot project.
- In the case of this template, avoid adding sub-projects inside of the 'app' directory. Instead, place them one level up in the root of the cloned directory structure.
- In order to get NuGet to work with Godot's C# project setup at all, it was necessary to add a 'nuget.config' file to the root directory of the 'app' C# project.
- The essential problem with Godot C# projects as they come out-of-the-box (from Godot version 3.3.0 and up), is that they require the
Godot.NET.Sdk/3.3.0
sdk to work. This sdk is supposed to be downloaded by NuGet. However NuGet doesn't seem to know where to get it from, by default. - This issue is separate from Visual Studio - it is NuGet itself, which isn't playing nice.
- For more details, see this git issue: godotengine/godot#58955
- The essential problem with Godot C# projects as they come out-of-the-box (from Godot version 3.3.0 and up), is that they require the