GDScript to C# Converter

Convert Godot Engine's native GDScript code to C# and vice versa, mapping types, nodes, lifecycles, and formatting.

Godot Engine GDScript vs. C# Syntax Reference

Inheritance & Lifecycle Methods

In Godot, scripts attach to Nodes. Class headers and lifecycle methods behave similarly but follow language-specific conventions:

GDScript Lifecycle

extends CharacterBody2D ** func _ready() -> void: position = Vector2.ZERO ** func _process(delta: float) -> void: queue_redraw()

// C# Lifecycle using Godot; public partial class Player : CharacterBody2D {"{"} public override void _Ready() {"{"} Position = Vector2.Zero; {"}"} ** public override void _Process(double delta) {"{"} QueueRedraw(); {"}"} {"}"}

Core Translation Key Concepts

  • Naming Conventions: GDScript uses snake_case (move_and_slide, global_position), whereas C# follows Microsoft's PascalCase guidelines (MoveAndSlide, GlobalPosition) for API properties and methods.

  • Signal Connections: Signals connected in GDScript via .connect() are linked in C# using standard C# events with += operators or Connect() calls.

  • Type Casting: C# is strongly typed. Converting nodes from GetNode() requires providing type parameters: GetNode<Sprite2D>("Sprite").

Related Tools

Check out other dynamic tools in the collection.