Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
调试工具概述
本指南将概述引擎中可用的调试工具.
Godot自带强大的调试器和剖析器, 可以追踪bug, 在运行时检查你的游戏, 监控重要指标, 并测量性能. 它还提供了在运行游戏中可视化碰撞框和导航多边形的选项.
最后, 你可以选择调试在远程设备上运行的游戏, 并在游戏运行时重新加载对你的场景或代码的修改.
Output Panel
The output panel allows you to see text printed by the project, but also by the editor (e.g. from @tool
scripts).
You can find information about in Output panel.
调试器面板
Godot 的许多调试工具都是“调试器”面板的一部分,你可以在 调试器面板 中找到相关信息。
脚本编辑器调试工具和选项
脚本编辑器有自己的一套调试工具,用于断点和两个选项。断点工具也可以在调试器的调试器选项卡中找到。
小技巧
You can create a breakpoint by clicking the gutter in the left of the script editor (on the left of the line numbers). When hovering this gutter, you will see a transparent red dot appearing, which turns into an opaque red dot after the breakpoint is placed by clicking. Click the red dot again to remove the breakpoint. Breakpoints created this way persist across editor restarts, even if the script wasn't saved when exiting the editor.
You can also use the breakpoint
keyword in GDScript to create a
breakpoint that is stored in the script itself. Unlike breakpoints created by
clicking in the gutter, this keyword-based breakpoint is persistent across
different machines when using version control.

断点 按钮会像断点一样导致脚本的中断. 继续 使游戏在断点处暂停后继续. Step Over 进入下一行代码, 如果可能的话, Step Into 进入一个函数. 否则, 它与 Step Over 做同样的事情.
The Debug with External Editor option lets you debug your game with an external editor. You can set a shortcut for it in Editor Settings > Shortcuts > Debugger.
当调试器在断点处中断时,脚本编辑器的排水沟中会显示一个绿色的三角箭头。此箭头表示调试器中断的代码行。
调试项目设置
In the project settings, there is a Debug category with subcategories which control different things. Enable Advanced Settings to change these settings.
Settings(设置)
这些都是一些常规的设置,比如将当前的 FPS 打印到输出面板,剖析时的最大函数量等。
File Logging
These settings allow you to log console output and error messages to files.
GDScript
These settings allow you to toggle specific GDScript warnings, such as for unused variables. You can also turn off warnings completely. See GDScript 警告系统 for more information.
Shader Language
These settings allow you to toggle specific shader warnings, such as for unused variables. You can also turn off warnings completely.
Canvas Items
These settings are for canvas item redraw debugging.
Shapes(形状)
Shapes中你可以调整形状的颜色, 这些形状只出现在调试的目的, 如碰撞和导航形状.
遥控场景面板
当在编辑器中运行游戏时,场景面板顶部会出现两个选项,即远程和本地。当使用远程时,你可以检查或改变运行项目中的节点参数。

备注
一些与调试有关的编辑器设置可以在 Editor Settings 内找到, 在 Network > Debug and Debugger 部分.