据 AlphaMoat 统计,截至 2026-09,Godot 4.6 C# Development 累计下载 2,615 次、获 0 个星标,在全部 5,078 个 AI 技能中排名第 4,011 位,在「开发编程」分类(577 个)中排名第 502 位。
| 平台 | 累计安装 | 累计下载 | 星标 | 评论 |
|---|---|---|---|---|
| ClawHub ↗ | 31 | 1,228 | - | - |
| SkillHub ↗ | 284 | 2,615 | - | — |
各平台的计数口径不同,统计时间不一致。
整理 Autoload 管理器、节点组织和信号解耦模式,给出强类型、导出资源、对象池及调试分析示例。强调避免逐帧加载资源和在 _Process 中分配内存。适用于已有 Godot C# 项目的设计、排错及 GDScript 迁移参考;具体 API 需结合项目版本核对。
资料发布于 2026-10-26
以下是根据技能文档生成的示例,不代表实际运行结果。
2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。
| 月份 | 累计下载 | 环比 | 星标 |
|---|---|---|---|
| 2026-09 | 2,615 | — | - |
| 2026-08 | 1,894 | +17.3% | - |
| 2026-07 | 1,615 | +27.3% | - |
| 2026-06 | 1,269 | +15.2% | - |
| 2026-05 | 1,102 | — | - |
| 2026-03 | 561 | — | - |
以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。
--- 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 单例模式
使用 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)
使用 gh CLI 与 GitHub 交互,通过 gh issue、gh pr、gh run 和 gh api 管理议题、PR、CI 运行及高级查询。
Multi search engine integration with 16 engines (7 CN + 9 Global). Supports advanced search operators, time filters, site search, privacy engines, and Wolfra...
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
生成有效的 Mermaid 图表,如流程图、时序图、思维导图、ER 图、用户旅程等。
通过托管 OAuth 集成 YouTube DataAPI,支持视频搜索、播放列表管理、频道数据访问及评论互动。当用户需要与 YouTube 交互时使用本技能。其他第三方应用请使用 api-gateway 技能(https://clawhub.ai/byungkyu/api-gateway)。
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 (
覆盖规划、实现、验证与测试的编码工作流技能。
核心 Docker 命令和工作流程,包括容器管理、镜像操作和调试。
数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。