godot-csharp
БесплатноБез исполняемых скриптовНе проверен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…
от gamedev-skills★ 12 656 звёзд на GitHubОб этом скилле
Godot C# / .NET (4.x)
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, which needs a .NET 8 or later SDK
(9 or later for Android). .NET 8 and 9 are out of support since 2026-11-10, so install the
.NET 10 (LTS) SDK. Read the .csproj first: its Sdk="Godot.NET.Sdk/x.y.z" is the
engine version.
Workflow
- Confirm the toolchain. The project needs the Godot .NET editor build (the
standard build cannot load C#) and a .NET SDK:
dotnet --list-sdksshould show 8.0 or later, and 9.0 or later if the project exports to Android. If you install one, use a supported SDK (10.0 LTS), not 8.0 or 9.0. - Every script is a
public partial classwhose name matches its.csfile name and that extends a Godot type. The generators that wire[Export],[Signal]and method bindings only work onpartialclasses. - Override lifecycle methods in PascalCase with
doubledelta:_Ready(),_Process(double delta),_PhysicsProcess(double delta). - Signals: a
[Signal]delegate namedXxxEventHandlerbecomes theXxxsignal, anXxxC# event andSignalName.Xxx. Emit withEmitSignal(SignalName.Xxx, ...). - Verify before you finish:
- Build:
dotnet build <project>.csprojfrom 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 --quitalso builds, through the editor.) - Smoke run with the .NET editor binary:
godot --headless --path <project> --quit-after 300 > run.log 2>&1, thengrep -nE "SCRIPT ERROR|^ERROR:" run.log. An unhandled exception in a callback is logged as anERROR:with its stack trace and the game keeps running, so the exit code stays 0. - If
godot-nodes-scenesis installed,python3 ../godot-nodes-scenes/scripts/check_godot_project.py <project>catches broken script and scene paths in.tscnfiles. - For behaviour tests in CI, follow
godot-gdscript-headless-testing; build before the test step.
- Build:
Patterns
1. A node script: lifecycle, [Export], GetNode
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();
}
}
2. Signals as C# events
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}");
}
3. Instancing a scene
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);
}
}
4. Calling GDScript from C#
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));
Gotchas
Cannot instantiate C# script because the associated class could not be found→ the class name differs from the file name (case-sensitive), or the project was not rebuilt.- Build errors from generated code, or
[Export]missing in the Inspector → the class is notpartial, 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. PassMethodName.AddChild(or"add_child") instead.- **An o
Установить godot-csharp в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл godot-csharp?
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`).
Как установить скилл godot-csharp?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл godot-csharp запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic