With the release of version 3.0 of the Godot Engine, C# was added as a supported programming language. Due to other engines like Unity, there is a large number of C# assemblies which can help in developing a game. However, there isn’t an easy way to add assemblies in the editor. Therefore, this tutorial was created to help with that problem.
In this tutorial, we’ll use the Godot Engine, version 3.0, along with the assembly for Rant. Note that while a C# assembly can be added to the editor, the assembly cannot be exported to a self-contained executable just yet.
Update: as of version 3.0.5 of the Godot Engine, exporting C# projects with assemblies have become possible.
1. Create project as normal. Where necessary, add a C# script. At first, the engine will generate the necessary C# files (i.e. the “*.csproj” and “*.sln” files).
3. Ensure that the correct assembly is in the Godot project working directory.
4. Go into a desirable IDE and open up the “*.csproj” file which was created when the C# script was added. Monodevelop will be used in this tutorial. At this point, ensure that the Godot editor isn’t running. Otherwise, key files may be overwritten.
5. In Monodevelop, right-click on the
References node in the tree view for the project and click on
Edit References... Be sure to first expand the project so as to reveal
References. Then click on the
.NET assembly tab and click “Browse…”.
6. Select the desired assembly for the project and then click “Open”.
7. It should then be added as a reference for the project. Click “OK” and save the project (“Ctrl + S” or “File -> Save”). Exit out of the IDE and go back into the Godot editor.
8. Add in a GDscript which makes use of the assembly.
9. If all goes well, the engine should use the assembly in the resulting game.
If you have any comments or questions, please ask them below, or get in touch with me.