C# and .NET in Godot 4.7: partial node classes, the PascalCase lifecycle, [Export] and [Signal], signals as C# events, the .csproj and calling GDScript. Use for .cs scripts in Godot, porting GDScript to C#, a failed build, or a failed web or Android export. Not for GDScript (`godot-gdscript`), Unity C# (`unity-csharp-scripting`) or export presets (`godot-export`).
Ships in gamedev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Write Godot game code in C# that the source generators accept, build it from the command
line, and check it runs. Targets Godot 4.7 .NET with the .NET 8 SDK (9 for
Android). Read the .csproj first: its Sdk="Godot.NET.Sdk/x.y.z" is the engine version.
dotnet --list-sdks should show 8.0 or
later, and 9.0 or later if the project exports to Android.public partial class whose name matches its .cs file name and
that extends a Godot type. The generators that wire [Export], [Signal] and method
bindings only work on partial classes.double delta: _Ready(),
_Process(double delta), _PhysicsProcess(double delta).[Signal] delegate named XxxEventHandler becomes the Xxx signal, an
Xxx C# event and SignalName.Xxx. Emit with EmitSignal(SignalName.Xxx, ...).dotnet build <project>.csproj from the project folder must exit 0 with no
errors. Godot's runtime does not compile C#, so a headless run uses whatever was built
last. (godot --headless --build-solutions --quit also builds, through the editor.)godot --headless --path <project> --quit-after 300 > run.log 2>&1,
then grep -nE "SCRIPT ERROR|^ERROR:" run.log. An unhandled exception in a callback is
logged as an ERROR: with its stack trace and the game keeps running, so the exit code
stays 0.godot-nodes-scenes is installed, python3 ../godot-nodes-scenes/scripts/check_godot_project.py <project>
catches broken script and scene paths in .tscn files.godot-gdscript-headless-testing; build before the
test step.using Godot;
public partial class Player : CharacterBody2D
{
[Export] public float Speed { get; set; } = 200.0f;
[Export] public float JumpVelocity { get; set; } = -400.0f;
private AnimatedSprite2D _sprite;
public override void _Ready()
{
_sprite = GetNode<AnimatedSprite2D>("AnimatedSprite2D");
}
public override void _PhysicsProcess(double delta)
{
Vector2 v = Velocity; // struct copy: edit, then assign back
if (!IsOnFloor())
v += GetGravity() * (float)delta;
if (Input.IsActionJustPressed("jump") && IsOnFloor())
v.Y = JumpVelocity;
float dir = Input.GetAxis("move_left", "move_right");
v.X = dir != 0 ? dir * Speed : Mathf.MoveToward(v.X, 0, Speed);
Velocity = v;
MoveAndSlide();
}
}
using Godot;
public partial class Health : Node
{
[Signal] public delegate void HealthChangedEventHandler(int current, int max);
private int _hp = 100;
public override void _Ready() => HealthChanged += OnHealthChanged;
public override void _ExitTree() => HealthChanged -= OnHealthChanged;
public void TakeDamage(int amount)
{
_hp = Mathf.Max(_hp - amount, 0);
EmitSignal(SignalName.HealthChanged, _hp, 100);
}
private void OnHealthChanged(int current, int max) => GD.Print($"HP {current}/{max}");
}
public partial class Spawner : Node2D
{
private static readonly PackedScene Bullet = GD.Load<PackedScene>("res://bullet.tscn");
public void Shoot(Vector2 at)
{
var b = Bullet.Instantiate<Node2D>();
b.Position = ToLocal(at); // world -> this parent's space, before _Ready runs
AddChild(b);
}
}
Node gd = GetNode("Enemy"); // a node with a .gd script
gd.Call("take_damage", 10); // snake_case names, checked at runtime
int score = gd.Get("score").AsInt32();
gd.Connect("died", Callable.From(OnDied));
Cannot find class X for script res://X.cs → the class name differs from the file name.[Export] missing in the Inspector → the class is
not partial, or the project was not rebuilt. The Inspector only shows members from the
last successful build.CallDeferred("AddChild", node) does not work → string-based engine calls (Call,
CallDeferred, Get, Set, Connect) use the engine's snake_case names. Pass
MethodName.AddChild (or "add_child") instead._process, or float delta).
C# uses PascalCase and double.[Signal] not found → the delegate name must end in EventHandler; the signal is the
name without it.ObjectDisposedException inside a signal handler → the receiver was freed while the
emitter lived on, and Godot could not disconnect it because the signal is a custom
[Signal] or the handler is a lambda that captures variables. Unsubscribe with -= in
_ExitTree() (Pattern 2), and check GodotObject.IsInstanceValid(node) before using
nodes that may be gone.Velocity.X will not compile → Vector2, Color and Transform2D are
structs. Copy, change, assign back.node.TakeDamage(10)), C# calls GDScript by its snake_case names
(Call("take_damage", 10)). A Call() with the wrong number of arguments fails without
an error, so assert on the effect in a test.Console.WriteLine output is missing → use GD.Print/GD.PrintErr/GD.PushError so
it reaches the Output panel and log file..csproj switches to
net9.0 for Android, so the .NET 9 SDK is required. Keep that condition when editing the
file.references/csharp-setup-and-interop.md for .csproj details and NuGet, export
attribute variants, Godot.Collections vs System.Collections, await ToSignal(...),
[GlobalClass] resources, a GDScript-to-C# API table, and per-platform export notes.godot-gdscript: the GDScript equivalents of these patterns.godot-signals-groups: signal architecture, language-neutral.godot-resources: data resources; [GlobalClass] is C#'s class_name.godot-export: presets and command-line exports.unity-csharp-scripting: C# in Unity, for developers coming from there.Last verified: 2026-11-11 against the Godot 4.7.2 docs and engine source (C# was not built or run for this check).
.csproj targets net8.0 and net9.0 when GodotTargetPlatform is android.What SKILL.md sets; muted values are Claude Code's defaults
/gamedev:godot-csharpfrom gamedev
npx claudepluginhub cirobarone78/games-skill --plugin gamedev80 skills in this plugin
/ai-behavior-trees-utility-aiEngine-neutral behavior tree and utility AI code for NPCs in any language: Blackboard, reactive composites, decorators and response-curve scoring. Use when an enemy keeps chasing after losing sight, restarts its action every frame or flip-flops between choices. Not for FSMs, steering or pathfinding (`game-ai`) or Unreal BT, EQS and StateTree (`unreal-behavior-trees`).
/audio-designEngine-neutral game audio technique: bus layout, volume sliders in decibels, loudness, ducking music under dialogue, adaptive music and SFX variation, with Godot, Unity and FMOD/Wwise mappings. Use when mixing a game, making music react to combat, fixing repetitive footsteps or beat sync, or a mix that clips or pumps. Not for the Godot audio API (`godot-audio`).
/