GDScript for C# Developers
Move from C# to Godot 4 GDScript: script typing, collection ownership, callables, objects, signals and explicit failure contracts. Build a stock depot in 48 genuine multi-file console lessons.
C# and GDScript side by side
The same program in C# and in GDScript, from the lessons of this course.
Text and Comments
C# Console.WriteLine writes a formatted line; GDScript print concatenates its arguments without inserting separators. Choose spaces and numeric formatting explicitly. GDScript uses indentation and # comments instead of C# braces and // comments. Statements…
C#1using System;2using System.Collections.Generic;3using System.Linq;4using System.Globalization;5public static class Program {6 7public static void Main() {8CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;9Console.WriteLine("tag {0}",7); Console.WriteLine("# data");10}11}GDScript1extends Node2 3func _ready() -> void:4 print("tag", 7)5 print("# data")Branches and Values
C# separates statement blocks with braces and writes a conditional as condition ? first : second. GDScript uses indentation, if/elif/else and a selected-value-first conditional expression. Ordered branches select the first match, so a broad early condition…
C#1using System;2using System.Collections.Generic;3using System.Linq;4using System.Globalization;5public static class Program {6 7public static void Main() {8CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;9int n=-2; Console.WriteLine(n<0 ? "west" : "east");10}11}GDScript1extends Node2 3func _ready() -> void:4 var n: int = -25 print("west" if n < 0 else "east")Array Operations
A GDScript Array is growable like C# List<T>, not fixed-length like a C# array. Ordinary indexing is zero-based, and GDScript additionally allows negative indices from the end; C# uses separate end-relative index syntax in newer versions. append mutates the…
C#1using System;2using System.Collections.Generic;3using System.Linq;4using System.Globalization;5public static class Program {6 7public static void Main() {8CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;9var items=new List<int>{3}; items.Add(8); int removed=items[items.Count-1];items.RemoveAt(items.Count-1);Console.WriteLine("{0} {1}",removed,items.Count);10}11}GDScript1extends Node2 3func _ready() -> void:4 var items: Array = [3]5 items.append(8)6 var removed = items.pop_back()7 print("%d %d" % [removed,items.size()])String Operations
C# strings are immutable reference objects. GDScript String has value semantics with copy-on-write storage; common methods such as replace return a new value. Assignment of that result is separate from changing the original binding. Method names differ…
C#1using System;2using System.Collections.Generic;3using System.Linq;4using System.Globalization;5public static class Program {6 7public static void Main() {8CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;9string s="a-b-a";string t=s.Replace("-","/");Console.WriteLine(s+" "+t);10}11}GDScript1extends Node2 3func _ready() -> void:4 var s: String = "a-b-a"5 var t: String = s.replace("-","/")6 print(s," ",t)Scripts as Classes
C# files can contain several types and namespaces. A GDScript file defines a script class; class_name registers a global script name, and extends selects a base class. Keep one named type per file. Instantiate it with new(), not a C# constructor expression.…
C#1public class DemoToken { public string Text="blue"; }GDScript1class_name DemoToken2extends RefCounted3var text: String = "blue"Inheritance and Super
C# classes and GDScript scripts each have one direct class base. C# generally requires virtual or abstract for overriding; GDScript instance methods can be overridden without a virtual keyword. Use super to invoke inherited behavior, where C# uses base.…
C#1public class DemoBase { public virtual string Label(){return "base";} }GDScript1class_name DemoBase2extends RefCounted3func label() -> String:4 return "base"
Syllabus
10 chapters48 lessons1 project48 challenges99 quiz questionsScripts and Scalar Values
6 lessonsFlow and Functions
6 lessonsCollection Ownership
6 lessonsText and Callable Values
3 lessonsObjects and State
5 lessonsObject Relationships
5 lessonsEvents and Failure
5 lessonsBoundaries and Lifetimes
6 lessonsConnected Stock Depot
Project4 lessonsFinal Ports
2 lessonsFrequently asked questions
Who is GDScript for C# Developers for?
For people who already write C# and want to learn GDScript. Each lesson starts from C# you know and shows how GDScript does the same thing, so you skip the beginner basics.
Do I need to know GDScript already?
No. The course starts with your first GDScript program. You need C# basics: variables, conditions, loops, functions and collections.
How many lessons does GDScript for C# Developers have?
GDScript for C# Developers contains 48 interactive lessons you can complete at your own pace.
What does GDScript for C# Developers cover?
The course is organized into chapters covering: Scripts and Scalar Values, Flow and Functions, Collection Ownership, Text and Callable Values, and more.
Is GDScript for C# Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.