C# for GDScript Developers
Use your GDScript experience to learn C# types, flow, methods, collections and object design. Build and test a multi-file order-processing program with compatible Mono C#.
GDScript and C# side by side
The same program in GDScript and in C#, from the lessons of this course.
Run Your First C# Program
GDScript runs inside the Godot engine, which loads a script attached to a node and calls callbacks such as _ready. A console C# program has no engine: the compiler checks every declared class and method first, then the runtime starts the static Main method.…
GDScript1extends Node2 3func _ready() -> void:4 print("C# is ready")C#1Console.WriteLine("C# is ready");Output, Comments and Main
GDScript print becomes Console.WriteLine. GDScript # comments become // comments. Colons and indentation group GDScript blocks, but braces define C# blocks and semicolons terminate statements. GDScript print glues several arguments together; in C#, build one…
GDScript1extends Node2 3func _ready() -> void:4 print("Hi, " + "Mina") # A commentC#1Console.WriteLine("Hi, " + "Mina"); // A commentBoolean Logic and Equality
GDScript treats 0, empty strings, empty arrays and null as false in a condition, and accepts both and/or/not and &&/||/!. C# conditions require bool and use only &&, || and !. A GDScript if items: check cannot be copied into C# without an explicit Length or…
GDScript1extends Node2 3func _ready() -> void:4 var active := true5 print("true" if 20 >= 18 and active else "false")C#1bool active = true;2Console.WriteLine((20 >= 18 && active) ? "true" : "false");Arrays and Bounds
GDScript arrays grow with append and accept negative indices such as values[-1]. C# arrays have a fixed length and negative indices are invalid. An out-of-range GDScript read is a script error with no try/catch to recover, while C# throws an…
GDScript1extends Node2 3func _ready() -> void:4 var values: Array[int] = [4, 6]5 print(values.size())C#1int[] values = { 4, 6 };2Console.WriteLine(values.Length);Dictionaries and Missing Keys
GDScript Dictionary.get(key, default) returns the default when a key is absent, and reading a missing key with [] stops the function with a script error. C# TryGetValue separates the presence bool from the out value, and its indexer throws…
GDScript1extends Node2 3func _ready():4 var values := {}5 print(values.get("missing", 0))C#1var values = new Dictionary<string,int>();2int count;3Console.WriteLine(values.TryGetValue("missing", out count) ? count : 0);Methods, Defaults and params
GDScript default parameters map to C# optional parameters, and a GDScript variadic ...values parameter maps to a C# params array, which also accepts an existing array. C# adds named arguments and overloading, which GDScript lacks. Static C# helper methods…
GDScript1extends Node2 3func total(factor := 2, ...values: Array) -> int:4 var sum := 05 for value in values:6 sum += value7 return sum * factor8 9func _ready():10 print(total(3, 2, 4))C#1static string JoinTags(string prefix = "tags", params string[] tags) { return prefix + ":" + string.Join(",", tags); }
Syllabus
11 chapters48 lessons1 project48 challenges99 quiz questionsStart Here
1 lessonC# Values and Text
6 lessonsDecisions and Missing Values
5 lessonsLoops and Sequences
5 lessonsCollections and Queries
5 lessonsMethods and Callbacks
5 lessonsReliable C# Modules
5 lessonsClasses and Encapsulation
5 lessonsPolymorphism and Equality
5 lessonsProject: Order Pipeline
4 lessonsFinal Challenges
2 lessonsFrequently asked questions
Who is C# for GDScript Developers for?
For people who already write GDScript and want to learn C#. Each lesson starts from GDScript you know and shows how C# does the same thing, so you skip the beginner basics.
Do I need to know C# already?
No. The course starts with your first C# program. You need GDScript basics: variables, conditions, loops, functions and collections.
How many lessons does C# for GDScript Developers have?
C# for GDScript Developers contains 48 interactive lessons you can complete at your own pace.
What does C# for GDScript Developers cover?
The course is organized into chapters covering: Start Here, C# Values and Text, Decisions and Missing Values, Loops and Sequences, and more.
Is C# for GDScript Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.