Menu
CoddyTech
Course

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.

  1. 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}
    GDScript
    1extends Node2
    3func _ready() -> void:4	print("tag", 7)5	print("# data")
  2. 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}
    GDScript
    1extends Node2
    3func _ready() -> void:4	var n: int = -25	print("west" if n < 0 else "east")
  3. 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}
    GDScript
    1extends 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()])
  4. 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}
    GDScript
    1extends Node2
    3func _ready() -> void:4	var s: String = "a-b-a"5	var t: String = s.replace("-","/")6	print(s," ",t)
  5. 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"; }
    GDScript
    1class_name DemoToken2extends RefCounted3var text: String = "blue"
  6. 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";} }
    GDScript
    1class_name DemoBase2extends RefCounted3func label() -> String:4	return "base"

Syllabus

10 chapters48 lessons1 project48 challenges99 quiz questions

More courses for C# developers

Learn GDScript from another language

Frequently 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.

Coddy programming languages illustration

Start GDScript for C# Developers for free

Get started