Godot Csharpのロゴ

Godot Csharp

コミュニティ
EL4CTEO
godot-csharp

Godot 4.7 C#/.NET done right - csproj/SDK setup, partial classes and source generators, [Export]/[Signal]/[GlobalClass]/[Tool], C# signals and events that must be disconnected (ObjectDisposedException), StringName caching, Variant/collections marshaling, async ToSignal, GDScript interop, culture bugs, no web export, dotnet build errors as JSON. Use for any .cs file.

概要

公開者EL4CTEO
リポジトリgodot-skills
スキル名godot-csharp
スター
60
フォーク
6
同梱ファイル
3
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 3個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    EL4CTEOがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Godot Csharp」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/EL4CTEO/godot-skills/tree/main/skills/godot-csharp
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/EL4CTEO/godot-skills.git /tmp/godot-skills
mkdir -p .claude/skills
cp -r /tmp/godot-skills/skills/godot-csharp .claude/skills/godot-csharp
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでGodot Csharpを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にGodot Csharpを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Godot Csharpは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

C# / .NET in Godot 4.7

Build after every edit: python scripts/cs_build.py returns errors as {file, line, code, msg}. Use --doctor to check the setup and --init to create the csproj and sln exactly like the 4.7 editor does. The engine runs the last built assembly in .godot/mono/temp/bin/, so build before any smoke run. C# names: api_lookup.py Node3D.look_at prints Node3D.LookAt(Vector3, Vector3?, bool). C# names also work as queries.

Project setup (verified 4.7.2 template)

xml
<Project Sdk="Godot.NET.Sdk/4.7.2">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net9.0</TargetFramework>
    <EnableDynamicLoading>true</EnableDynamicLoading>
  </PropertyGroup>
</Project>
  • The Godot.NET.Sdk/x.y.z version must equal the engine version. Bump it when you upgrade Godot. net8.0 is the minimum; net9.0+ is allowed. <Nullable>enable</Nullable> is recommended.
  • project.godot needs "C#" in config/features and [dotnet] project/assembly_name. The assembly name must match the csproj name.
  • NuGet packages work normally (dotnet add package). Assemblies must be pure managed code, or ship native libraries for every target platform.
  • Not supported: web export of C# projects (still true in 4.7; use GDScript for web builds). Android needs net9.0 (the template handles it). iOS works. Desktop works everywhere.

Script rules (the source generators depend on them)

  • public partial class Player : CharacterBody3D. The file name must equal the class name (Player.cs). Namespaces are fine. Godot-derived classes must be partial.
  • [GlobalClass] registers the class in the Create dialog and as an exportable Resource type, like GDScript class_name. [Tool] runs the class in the editor.
  • Exports: [Export] public float Speed { get; set; } = 5f; plus [ExportGroup("Movement")], [ExportSubgroup], [ExportCategory], [Export(PropertyHint.Range, "0,100,1")] and [ExportToolButton("Bake")] public Callable BakeButton => Callable.From(Bake);.
  • Signals: [Signal] public delegate void HitEventHandler(int damage);. The suffix is required. The generator creates event Hit and SignalName.Hit. Emit with EmitSignal(SignalName.Hit, 5) and connect with enemy.Hit += OnHit;.
  • Use SignalName.*, MethodName.* and PropertyName.* (generated StringNames) wherever the API wants a name, so you never allocate strings.
  • Structs are copied: Position.X = 5 won't compile (CS1612). Write Position = Position with { X = 5 };.

Signal lifetime (official rules)

Godot disconnects everything when either object is freed, except:

  1. += to a custom [Signal], when the receiver is freed first, and
  2. lambdas that capture variables. Godot can't tie them to an instance, and Callable.From doesn't help. In both cases, unsubscribe with -= in _ExitTree (keep the delegate in a field for lambdas). Otherwise, emitting into a freed object throws ObjectDisposedException.

Performance and correctness

  • Cache input actions, groups and other names as static readonly StringName. Passing "jump" every frame allocates.
  • Use System.Collections.Generic for internal logic. Use Godot.Collections.Array<T>/Dictionary<TK,TV> only at the Godot boundary (exports, signals, GDScript calls). Each crossing marshals the data.
  • Packed arrays (Vector3[], byte[]) are copied on every API call. Read a mesh array once and work on the copy.
  • Avoid LINQ and closures in _Process/_PhysicsProcess hot loops. Prefer GetNode<T>() once in _Ready and keep the result in a field.
  • Culture bug: $"{1.5f}", float.Parse and ToString() follow the OS locale (1,5 in Italian, German, …). Use CultureInfo.InvariantCulture for saves, network data, JSON and UI number formats. (Observed on a 4.7.2 test machine.)
  • Exceptions in callbacks are logged, not fatal. Watch the Output/Debugger panel, or run_godot.py smoke errors.
  • GD.Print allocates. Remove it from hot paths, or put it behind #if DEBUG or OS.IsDebugBuild().

Async

  • await ToSignal(GetTree().CreateTimer(1.0), SceneTreeTimer.SignalName.Timeout); awaits a signal on the main thread.
  • Run CPU work on Task.Run/WorkerThreadPool, then get back to the main thread with CallDeferred or Callable.From(...).CallDeferred() before you touch nodes.
  • Await anything inside _Ready/_Process only through an async void handler, and keep it short. Check IsInstanceValid(this) after awaits.

GDScript ↔ C#

  • From C#: var gd = GetNode("Inventory"); gd.Call("add_item", "sword", 2); var n = gd.Get("count").AsInt32();. Connect to its signals with gd.Connect("changed", Callable.From<int>(OnChanged)).
  • From GDScript: C# public members appear with their C# names (node.Speed, node.Damage(5)). Signals keep their C# names (node.Hit.connect(...)).
  • Create GDScript objects from C#: GD.Load<GDScript>("res://x.gd").New().AsGodotObject().
  • Variant: Variant.From(x), v.As<T>(), v.AsInt32(), v.VariantType. Return Variant from methods GDScript calls dynamically.

Patterns, interop and editor/hot-reload notes (compiled by the tests): references/patterns.md.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Godot Csharp」では何ができますか?

Godot 4.7 C#/.NET done right - csproj/SDK setup, partial classes and source generators, [Export]/[Signal]/[GlobalClass]/[Tool], C# signals and events that must be disconnected (ObjectDisposedException), StringName caching, Variant/collections marshaling, async ToSignal, GDScript interop, culture bugs, no web export, dotnet build errors as JSON. Use for any .cs file.

TypingMindでGodot Csharpを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Godot Csharpはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにGodot Csharpをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/EL4CTEO/godot-skills/tree/main/skills/godot-csharpを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Godot Csharpを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Godot Csharpで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもGodot Csharpを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Godot Csharp」は無料ですか?

はい。EL4CTEOがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇