بنقرة واحدة
godot-compatibility-checker
自动检测和修复Godot 3.x与4.x之间的API兼容性问题,基于实际项目经验提供针对性解决方案
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
自动检测和修复Godot 3.x与4.x之间的API兼容性问题,基于实际项目经验提供针对性解决方案
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Godot技能统一入口,根据用户需求智能选择并调用最适合的Godot子技能,提供15个专业技能的一站式开发体验
为中文开发者提供完整的项目本地化、环境配置和开发工作流指导,确保中英文双语环境下的最佳开发体验
自动使用Context7进行文档研究,当用户需要代码生成、配置步骤或库/API文档时无需明确请求即可自动获取最新信息
GDScript 语法权威指南,提供最新 Godot 4.5 语法规范、最佳实践、缩进规则和代码风格
Godot 资源与动画创建专家,支持自然语言描述自动完成精灵导入、动画配置、特效制作、音效集成等资源工作
提供批量操作Godot节点的能力,支持批量更新属性、重命名、删除和创建节点,大幅提升开发效率
| 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 获取最佳实践建议