With several Unity developers moving to the Godot Game Engine the C# language support in the Godot engine just became much more important for future developments. Right now C# support is not perfect with for example the following platform limitations:
As it stands, Godot 4 has moved to a new model for creating extensions and adding language support, GDExtension. This is the mechanism for example that the recently announced Swift language was supported via SwiftGodot. You can see a breakdown of the Godot 3.x and 4.x extension systems and C# support mechanism in the following Tweet by Juan Linietsky:
There is now a technical discussion available discussing future Godot development roadmap for C# support. A key excerpt:
Describe the problem or limitation you are having in your project
The current implementatio of C# in Godot is done on top of the script layer directly and in C++ using the .NET hosting API.
This is due to how Godot worked in version 3. It currently has the following problems:
- Large amounts of C++ are required to glue Godot to the C# runtime, this makes it difficult to maintain and redundant with the new extension system in Godot 4. It is a lot of C++ code that supplies the same function as GDExtension.
- Many of the APIs exposed to C# currently are lagging behind what GDExtension provides, preventing many optimizations.
- It makes it harder to have a single version of Godot, because the large amount of glue code encourages users to switch it off when not needed to save space.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
The proposed solution is to move C# support to the new extension system in Godot 4.0.
This will give C# in Godot effective first class support at the same level C++ has, bringing the following features:
- The entirety of the C# glue layer (currently done via C++ .net hosting API) will be majorly replaced by GDExtension, using the extension interface common to all binding languages (GodotCPP, Rust, etc). The modules/mono folder will be removed from the codebase and likely replaced by only by a tiny boostrapper to load the .net runtime on demand if installed in the project.
- Because the entirety of the C# support will use the shared extension system (GDExtension), a single, unified version of Godot and the export templates will be possible.
- Some of the C# API, including the native Godot collections, will be changed for more efficiency
You can learn more about the current state of C# programming in the Godot game engine and discuss the future development roadmap of C# going forward in the video below.