overview_of_debugging_tools.rst 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. .. _doc_overview_of_debugging_tools:
  2. Overview of debugging tools
  3. ===========================
  4. This guide will give you an overview of the available debugging tools in the
  5. engine.
  6. Godot comes with a powerful debugger and profilers to track down bugs, inspect
  7. your game at runtime, monitor essential metrics, and measure performances.
  8. It also offers options to visualize collision boxes and navigation polygons
  9. in the running game.
  10. Finally, you have options to debug the game running on a remote device
  11. and to reload changes to your scenes or your code while the game is running.
  12. Debugger Panel
  13. --------------
  14. Many of Godot's debugging tools are part of the Debugger panel, which you can
  15. find information about in :ref:`doc_debugger_panel`.
  16. Debug menu options
  17. ------------------
  18. There are a few common debug options you can toggle on or off when running
  19. your game in the editor, which can help you in debugging your game.
  20. You can find these options in the **Debug** editor menu.
  21. .. image:: img/overview_debug.png
  22. Here are the descriptions of the options:
  23. Deploy with Remote Debug
  24. ++++++++++++++++++++++++
  25. When exporting and deploying, the resulting executable will attempt to connect
  26. to the IP of your computer for debugging.
  27. Small Deploy with Network FS
  28. ++++++++++++++++++++++++++++
  29. This option speeds up testing for games with a large footprint on remote devices.
  30. When **Small Deploy with Network FS** is on, instead of exporting the full game,
  31. deploying the game builds a minimal executable. The editor then provides files
  32. from the project over the network.
  33. Also, on Android, the game is deployed using the USB cable to speed up deployment.
  34. Visible Collision Shapes
  35. ++++++++++++++++++++++++
  36. This option makes collision shapes and raycast nodes visible in the running game.
  37. Visible Navigation
  38. ++++++++++++++++++
  39. Navigation meshes and polygons will be visible on the running game.
  40. Sync Scene Changes
  41. ++++++++++++++++++
  42. With this option, any change you make to a scene in the editor at runtime
  43. appears instantly. When used remotely on a device, this is more efficient
  44. with the network filesystem.
  45. Sync Script Changes
  46. +++++++++++++++++++
  47. Any script that is saved will be reloaded on the running game. When used
  48. remotely on a device, this is more efficient with the network filesystem.
  49. Script editor debug tools and options
  50. -------------------------------------
  51. The script editor has its own set of debug tools for use with breakpoints and
  52. two options. The breakpoint tools can also be found in the **Debugger** tab
  53. of the debugger.
  54. .. tip::
  55. You can create a breakpoint by clicking the gutter in the left of the script
  56. editor (on the left of the line numbers). When hovering this gutter, you
  57. will see a transparent red dot appearing, which turns into an opaque red dot
  58. after the breakpoint is placed by clicking. Click the red dot again to
  59. remove the breakpoint. Breakpoints created this way persist across editor
  60. restarts, even if the script wasn't saved when exiting the editor.
  61. You can also use the ``breakpoint`` keyword in GDScript to create a
  62. breakpoint that is stored in the script itself. Unlike breakpoints created by
  63. clicking in the gutter, this keyword-based breakpoint is persistent across
  64. different machines when using version control.
  65. .. image:: img/overview_script_editor.png
  66. The **Break** button causes a break in the script like a breakpoint would.
  67. **Continue** makes the game continue after pausing at a breakpoint.
  68. **Step Over** goes to the next line of code, and **Step Into** goes into
  69. a function if possible. Otherwise, it does the same thing as **Step Over**.
  70. The **Keep Debugger Open** option keeps the debugger open after a scene
  71. has been closed. And the **Debug with External Editor** option lets you
  72. debug your game with an external editor.
  73. When the debugger breaks on a breakpoint, a green triangle arrow is visible in
  74. the script editor's gutter. This arrow indicates the line of code the debugger
  75. broke on.
  76. .. warning::
  77. Breakpoints won't break on code if it's
  78. :ref:`running in a thread <doc_using_multiple_threads>`.
  79. This is a current limitation of the GDScript debugger.
  80. Debug project settings
  81. ----------------------
  82. In the project settings, there is a **Debug** category with three subcategories
  83. which control different things.
  84. Settings
  85. ++++++++
  86. These are some general settings such as printing the current FPS
  87. to the **Output** panel, the maximum amount of functions when profiling
  88. and others.
  89. GDScript
  90. ++++++++
  91. These settings allow you to toggle specific GDScript warnings, such as for
  92. unused variables. You can also turn off warnings completely.
  93. Shapes
  94. ++++++
  95. Shapes are where you can adjust the color of shapes that only appear for
  96. debugging purposes, such as collision and navigation shapes.
  97. Remote in scene dock
  98. --------------------
  99. When running a game in the editor two options appear at the top of the **Scene**
  100. dock, **Remote** and **Local**. While using **Remote** you can inspect or change
  101. the nodes' parameters in the running project.
  102. .. image:: img/overview_remote.png
  103. .. note:: Some editor settings related to debugging can be found inside
  104. the **Editor Settings**, under the **Network > Debug** and **Debugger** sections.