Mr.Tang

Godot 4.6 C# Development

Developmentv1.0.0
By Mr.TangUpdated 2026-05-11godot-dev@clawhub_thb32133451/godot-dev
Code GenerationScripting#Debugging#Game#开发

According to AlphaMoat, as of 2026-09, Godot 4.6 C# Development has 2,615 downloads and 0 stars — ranked #4,011 of 5,078 AI skills overall, and #502 of 577 in Development.

Installs
284
Downloads
2.6K
Stars
-
Overall Rank
#4,011
Top 79% overall · Top 88% in Development
PlatformInstallsDownloadsStarsComments
ClawHub ↗311.2K--
SkillHub ↗2842.6K-—

Platforms count differently and update at different times.

What this skill does

Covers Autoload managers, node organization and signal-based decoupling, with examples of strong typing, exported resources, object pools and debugging. Advises against loading resources every frame or allocating memory in _Process. Use it for design, troubleshooting and GDScript migration in an existing Godot C# project; check specific APIs against the project version.

Profile published 2026-10-26

What you can do with it

  • Review Godot C# project structure and performance issues

When to use it

  • When designing game systems or troubleshooting a Godot project

Example prompts

Generated from the skill’s documentation as examples; not results of actual runs.

Review this Godot C# system’s signals and resource-loading approach.

Monthly Trend

Downloads2.6K
3971.6K2.8K2026-03 · Downloads 5612026-05 · Downloads 1.1K2026-06 · Downloads 1.3K2026-07 · Downloads 1.6K2026-08 · Downloads 1.9K2026-09 · Downloads 2.6K26-0326-09
Stars-
0112026-03 · Stars -2026-05 · Stars -2026-06 · Stars -2026-07 · Stars -2026-08 · Stars -2026-09 · Stars -26-0326-09

The counting method changed in 2026-09: skills with the same name are now counted separately by author, and the full catalog is covered. Dashed lines show months before the change; they are not compared with later months, and no growth is computed across the change.

MonthDownloadsMoMStars
2026-092.6K—-
2026-081.9K+17.3%-
2026-071.6K+27.3%-
2026-061.3K+15.2%-
2026-051.1K—-
2026-03561—-

SKILL.md (original)

The author’s original file, shown as plain text without edits or review by AlphaMoat. Links are not clickable; check commands before running them. Fetched 2026-10-23.

3.5 KB · ClawHub v1.0.0
---
name: godot-dev
description: Godot 4.x game development with C#/.NET, covering best practices, architecture patterns, performance optimization, and common pitfalls. Use when working on Godot projects, debugging Godot-specific issues, designing game architecture, or implementing game systems. Includes GDScript-to-C# migration guidance.
---

# Godot 4.x C# 开发指南

## 核心架构原则

### 1. Autoload 单例模式
Show all (151 lines)
使用 Autoload 创建全局管理器:
```
GameManager (游戏状态)
EventManager (事件总线)
AudioManager (音频管理)
SaveManager (存档管理)
LocalizationManager (本地化)
```

### 2. 节点组织结构
```
GameScene (Node2D)
├── Entities (Node2D)
│   ├── Player (CharacterBody2D)
│   └── Enemies (Node2D)
├── Environment (Node2D)
│   ├── TileMaps
│   └── Props
└── UI (CanvasLayer)
    └── HUD
```

### 3. 信号驱动架构
使用信号解耦:
```csharp
// 定义信号
[Signal]
public delegate void HealthChangedEventHandler(int current, int max);

// 触发信号
EmitSignal(SignalName.HealthChanged, currentHealth, maxHealth);

// 连接信号
player.HealthChanged += OnHealthChanged;
```

## C# 特定最佳实践

### 类型安全
```csharp
// ✅ 正确:使用强类型
private PlayerController _player;

// ❌ 避免:过度使用 var 导致类型不明确
var player = GetNode("Player"); // Node? PlayerController?
```

### 资源加载
```csharp
// ✅ 推荐:预加载资源
[Export]
public PackedScene EnemyScene { get; set; }

// ⚠️ 运行时加载
var scene = GD.Load<PackedScene>("res://scenes/enemy.tscn");

// ❌ 避免:每帧加载
func _process():
    var tex = load("res://sprite.png")  # 性能杀手
```

### Godot 4.6 API 变化
```csharp
// Godot 4.5 → 4.6 迁移

// PhysicsRayQuery2D 已弃用
// ❌ 旧版
var query = PhysicsRayQuery2D.Create(from, to);

// ✅ 新版
var query = new PhysicsRayQueryParameters2D
{
    From = from,
    To = to,
    CollisionMask = collisionMask
};
var result = space.IntersectRay(query);

// Dictionary 类型限制
// ❌ Godot.Collections.Dictionary 不支持复杂类型
Godot.Collections.Dictionary<string, EnemyData> dict;

// ✅ 使用 System.Collections.Generic
System.Collections.Generic.Dictionary<string, EnemyData> dict;
```

## 性能优化

### 对象池
```csharp
public class ObjectPool<T> where T : Node, new()
{
    private readonly Stack<T> _pool = new();
    private readonly PackedScene _scene;

    public T Get() => _pool.Count > 0 ? _pool.Pop() : _scene.Instantiate<T>();
    
    public void Return(T obj)
    {
        obj.GetParent()?.RemoveChild(obj);
        _pool.Push(obj);
    }
}
```

### 避免常见陷阱
1. **不要在 _Process 中分配内存**
2. **使用 [Export] 而非字符串路径**
3. **批量处理物理操作**
4. **关闭不需要的节点处理**: `ProcessMode = ProcessModeEnum.Disabled`

## 调试技巧

### 自定义调试输出
```csharp
public static class Debug
{
    [Conditional("DEBUG")]
    public static void Log(string message)
    {
        GD.Print($"[{Time.GetTimeStringFromSystem()}] {message}");
    }
}
```

### 性能分析
```
# 启用调试模式
godot --path . --debug-gd

# 使用内置分析器
Debugger > Profiler > Start
```

## 参考资源

- **Godot 4.6 API 文档**: [references/godot-46-api.md](references/godot-46-api.md)
- **C# 模式**: [references/csharp-patterns.md](references/csharp-patterns.md)
- **常见错误**: [references/common-errors.md](references/common-errors.md)
- **性能指南**: [references/performance.md](references/performance.md)

Popular in Development

GithubDevelopment

Interact with GitHub using the gh CLI. Use gh issue, gh pr, gh run, and gh api for issues, PRs, CI runs, and advanced queries.

↓ 386.6K★ 708Peter Steinberger
Multi Search EngineDevelopment

Multi search engine integration with 16 engines (7 CN + 9 Global). Supports advanced search operators, time filters, site search, privacy engines, and Wolfra...

↓ 162.1K★ 763g_pyAng
McporterDevelopment

Use the mcporter CLI to list, configure, auth, and call MCP servers/tools directly (HTTP or stdio), including ad-hoc servers, config edits, and CLI/type generation.

↓ 80.3K★ 204Peter Steinberger
Mermaid DiagramDevelopment

Generate valid Mermaid diagrams like flowcharts, sequence diagrams, mind maps, ER diagrams, or user journeys from text or product descriptions.

↓ 73.4K★ 59pupujanet-eng
YouTubeDevelopment

YouTube Data API integration with managed OAuth. Search videos, manage playlists, access channel data, and interact with comments. Use this skill when users want to interact with YouTube. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Calls run through the maton CLI with OAuth login, or over raw HTTP with a Maton API key where the CLI cannot be installed. Every call is authenticated as the user's connection and reaches only what that connection's authorization allows, which the provider enforces on every request; the endpoints documented here are the ones this skill uses, and any other endpoint of this app needs the user to ask for it by name. Default to read and list calls, and confirm every write or new connection with the user. This file also documents the three constructs that turn a YouTube connection into automation, in the order they are used: the connection (the first step), a hosted function that runs a YouTube action through the Maton SDK, and a trigger that calls that function on a schedule or on an event. Those sections are the platform's own reference text, shared with the api-gateway skill, with YouTube examples; they add no YouTube capability - YouTube is not an event source, a trigger cannot read YouTube data, and the files under references/<source>/triggers.md are the platform's event catalogues for the sources Maton offers (time, Calendly, GitHub, Gmail, HubSpot, Linear, Notion, Slack, Stripe).

↓ 61.6K★ 145byungkyu
GitHubDevelopment

GitHub API integration with managed OAuth. Access repositories, issues, pull requests, commits, branches, and users. Use this skill when users want to interact with GitHub repositories, manage issues and PRs, search code, or automate workflows. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Calls run through the maton CLI with OAuth login, or over raw HTTP with a Maton API key where the CLI cannot be installed. Every call is authenticated as the user's connection and reaches only what that connection's authorization allows, which the provider enforces on every request; the endpoints documented here are the ones this skill uses, and any other endpoint of this app needs the user to ask for it by name. Default to read and list calls, and confirm every write or new connection with the user. This file also documents the three constructs that turn a GitHub connection into automation, in the order they are used: the connection (the first step), a hosted function that runs a GitHub action through the Maton SDK, and a trigger that calls that function on a schedule or on an event. Those sections are the platform's own reference text, shared with the api-gateway skill, with GitHub examples; they add no GitHub capability - GitHub is itself an event source, so its own events are in references/github/triggers.md, and the files under references/<source>/triggers.md are the platform's event catalogues for the sources Maton offers (time, Calendly, GitHub, Gmail, HubSpot, Linear, Notion, Slack, Stripe).

↓ 38.2K★ 53byungkyu
CodeDevelopment

A coding workflow skill covering planning, implementation, verification, and testing.

↓ 36.8K★ 66Iván
Docker EssentialsDevelopment

Essential Docker commands and workflows for container management, image operations, and debugging.

↓ 36.6K★ 42Arnarsson

Data month: 2026-09 · Downloads, stars and installs are aggregated monthly from public skill registries (ClawHub, SkillHub). See methodology.