用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/hhhh124hhhh/godot-mcp --skill godot-compatibility-checker命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | godot-compatibility-checker |
| description | 自动检测和修复Godot 3.x与4.x之间的API兼容性问题,基于实际项目经验提供针对性解决方案 |
| version | 1.0.0 |
| allowed-tools | Read, Write, Edit, Glob, Grep |
当用户遇到Godot版本相关问题或需要进行版本升级时,自动进行兼容性检查和修复:
问题: Invalid assignment of property or key 'emission_amount' on a base object of type 'ParticleProcessMaterial'
修复方案:
# ❌ Godot 3.x 错误写法
var material = ParticleProcessMaterial.new()
material.emission_amount = 50
material.lifetime = 1.5
# ✅ Godot 4.x 正确写法
var particles = GPUParticles2D.new()
var material = ParticleProcessMaterial.new()
particles.amount = 50 # 属性设置在节点层级
particles.lifetime = 1.5 # 属性设置在节点层级
particles.material = material
问题: interpolate_property() 和 set_looped() 方法不存在
修复方案:
# ❌ Godot 3.x 过时写法
var tween = Tween.new()
tween.interpolate_property(object, "property", start, end, 1.0)
tween.set_looped(true)
# ✅ Godot 4.x 现代写法
var tween = create_tween()
tween.tween_property(object, "property", end, 1.0)
# 使用回调实现循环
func animate_loop():
var tween = create_tween()
# 动画代码...
tween.tween_callback(animate_loop)
问题: 信号连接语法变化
修复方案:
# ❌ Godot 3.x 过时写法
connect("input_event", self, "_on_input_event")
# ✅ Godot 4.x 现代写法
input_event.connect(_on_input_event)
# 或使用lambda表达式
signal.signal_name.connect(func(): print("信号触发"))
问题: 鼠标按钮常量名称变化
修复方案:
# ❌ Godot 3.x 过时写法
if event.button_index == BUTTON_LEFT
# ✅ Godot 4.x 现代写法
if event.button_index == MOUSE_BUTTON_LEFT
问题: has_property() 方法被移除
修复方案:
# ❌ Godot 3.x 过时写法
if node.has_property("custom_property"):
value = node.get("custom_property")
# ✅ Godot 4.x 现代写法
if "custom_property" in node:
value = node.get("custom_property")
# 或更安全的检查
var property_value = node.get("custom_property")
if property_value != null:
value = property_value
原始错误: 粒子属性设置位置错误
修复位置: lines 142, 163, 196, 327
修复内容: 将 material.emission_amount 改为 particles.amount
修复内容:
opopped.emit → popped.emit)create_tween() 而非 Tween.new()ParticleProcessMaterial 而非 ParticlesMaterialin 操作符而非 has_property()call_deferred("queue_free")此技能主要使用以下MCP工具:
# 检测Godot版本 (通过Godot MCP)
await godotMCP.detect_godot_version({ projectPath: './project.godot' })
# 检查API兼容性 (通过Godot MCP)
await godotMCP.check_godot_api_compatibility({
code: fileContent,
targetVersion: '4.x'
})
# 自动修复兼容性问题 (通过Godot MCP)
await godotMCP.fix_godot_api_compatibility({
code: problematicCode,
issueIds: detectedIssues
})
detect_godot_version - 检测项目Godot版本check_godot_api_compatibility - 检查代码兼容性fix_godot_api_compatibility - 自动修复兼容性问题get_godot_migration_advice - 获取迁移建议detect_godot_version 确定当前和目标版本check_godot_api_compatibility 全面扫描代码fix_godot_api_compatibility 自动修复问题get_godot_migration_advice 获取最佳实践建议