How I learned the Godot C# API

The vast majority of tutorial code for Godot is in GDScript. There just aren’t many C#-specific resources on the web (that I’m aware of).

Yet the more I work with Godot, the more I’ve found that GDScript and C# have a lot in common. This makes porting the code in examples fairly straightforward — with some gotchas here and there, of course.

Here’s the path I took:

  1. I started with the official Godot tutorial. The page offers both GDScript and C# code snippets. The tutorial is not perfect, but it’s pretty good. I think it’s currently the best option for beginners to Godot & C#.
    1. For your reference I’ve open-sourced my C# version of the “Dodge the Creeps” game you make in the tutorial.
  2. Next, I took what I learned from the official docs and followed this platformer game tutorial that I found on YouTube. It’s great. Of course the author uses GDScript in his series so my best option was to translate the GDScript to C# as I went. This is difficult at times but very instructive.
    1. For your reference I’ve open-sourced my C# version of the platformer game made in this tutorial series.

When referencing the docs, I found it very beneficial to have the relevant C# differences close at hand: https://docs.godotengine.org/en/stable/getting_started/scripting/c_sharp/c_sharp_differences.html

I’ve also found this process — porting a game from GDScript to C# — to be a very effective way to learn Godot in general. Once you’ve developed a feel for how the GDScript translates over to C#, it makes finding C#-specific resources less severe an issue.

After all that, I took what I had learned to begin a personal game project: Agent of Procyon.

Eric
Eric

Code guy.

Articles: 8

Leave a Reply

Your email address will not be published. Required fields are marked *