Code translation lab

C# to GDScript Code Lab

Compare familiar Unity C# patterns against concise Godot 4 GDScript equivalents. Pick a topic, scan the differences, then copy the Godot version into your own scene script.

Live comparison

Variables

Unity C# to GDScript
Coached translation

Translation Workshop

You are turning a tuned Unity or Unreal component into a Godot script that designers can still adjust in the Inspector.

0/3 proofs
Habit shift

Godot exports variables from the script that owns the node. The important shift is deciding what belongs as editable data and what should stay internal state.

Unity C# habit Serialized fields live on a component or reflected C++ property.
Godot habit @export exposes node-owned data; := keeps local state readable without ceremony.
Unity C#
123456
public float speed = 5.0f;
private int health = 100;
[SerializeField]
private GameObject target;
[SerializeField]
private Sprite[] sprites;
GDScript ✨
1234
var speed := 5.0
var health := 100
@export var target: Node
@export var sprites: Array[Texture2D]
💡 @export = shows in Inspector (like [SerializeField])
ℹ️ Type inference with := (optional but recommended)

Quick Reference

_ready() = Start() / BeginPlay()
_process(delta) = Update() / Tick()
extends Node = : MonoBehaviour
@export var = [SerializeField]
$NodePath = GetComponent / FindChild
queue_free() = Destroy()