overview_of_debugging_tools.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. .. _doc_overview_of_debugging_tools:
  2. Overview of debugging tools
  3. ===========================
  4. Introduction
  5. ------------
  6. When developing your game, you want to test your game and debug when problems occurr. Godot provides several debugging options and
  7. tools which aid your debugging process. There are the debug dropdown options, Script editor debug options, debug project settings,
  8. and the debugger.
  9. Debug dropdown options
  10. ----------------------
  11. There are a few options that you can enable when running your game in the editor which can help you in debugging your game.
  12. These options are located in ``DEBUG`` in the main menus.
  13. .. image:: img/overview_debug.png
  14. Here are the descriptions of the options:
  15. Deploy with Remote Debug
  16. ++++++++++++++++++++++++
  17. When exporting and deploying, the resulting executable will attempt to connect to the IP of your computer, in order to be debugged.
  18. Small Deploy with Network FS
  19. ++++++++++++++++++++++++++++
  20. Export or deploy will produce minimal executable. The filesystem will be provided from the project by the editor over the network.
  21. On Android, deploy will use the USB cable for faster performance. This option speeds up testing for games with a large footprint.
  22. Visible Collision Shapes
  23. ++++++++++++++++++++++++
  24. Collision shapes and raycast nodes(for 2D and 3D) will be visible on the running game.
  25. Visible Navigation
  26. ++++++++++++++++++
  27. Navigation meshes and polygons will be visible on the running game.
  28. Sync Scene Changes
  29. ++++++++++++++++++
  30. Any changes made to the scene in the editor will be replicated in the running game.
  31. When used remotely on a device, this is more efficient with network filesystem.
  32. Sync Script Changes
  33. +++++++++++++++++++
  34. Any script that is saved will be reloaded on the running game.
  35. When used remotely on a device, this is more efficient with network filesystem.
  36. Script editor debug tools and options
  37. -------------------------------------
  38. The script editor has its own set of debug tools for use with breakpoints, and two
  39. options. The breakpoint tools can also be found in the "Debugger" tab of the debugger.
  40. ..image:: img/overview_script_editor.png
  41. The ``Break`` button causes a break in the script like a breakpoint would. ``Continue``
  42. makes the game continue after pausing at a breakpoint. ``Step Over`` goes to the next
  43. line of code, and ``Step Into`` goes into a function if possible, otherwise it does the
  44. same thing as ``Step Over``.
  45. The ``Keep Debugger Open`` option keeps the debugger open after a scene has been closed.
  46. And the ``Debug with External Editor`` option lets you debug your game with an external
  47. editor.
  48. Debug project settings
  49. ----------------------
  50. In the project settings there is a "Debug" category with three sub categories which
  51. control different things.
  52. Settings
  53. ++++++++
  54. These are some general settings such as printing the current FPS to the Output panel, the
  55. maximum ammount of functions when profiling and others.
  56. GDScript
  57. ++++++++
  58. These settings allow you to turn specific GDScript warnings, such as an unused variable, on
  59. or off. You can also turn off warnings completely.
  60. Shapes
  61. ++++++
  62. Shapes is where you can adjust the color of shapes that only appear for debugging purposes,
  63. such as collision and navigation shapes.
  64. Debugging tools
  65. ---------------
  66. The ``Debugger`` can be found in Godot's bottom panel. Click on it and the panel expands
  67. to show all the debugging tools.
  68. .. image:: img/overview_debugger.png
  69. There are multiple parts of the debugger, each is for a specific task.
  70. Debugger
  71. ++++++++
  72. The debugger tab is for working with breakpoints in the script. When a script reaches a breakpoint
  73. this panel gives you information on it.
  74. The buttons in the top right can be used respectively to:
  75. - Skip all defined breakpoints, without removing them (so you can toggle them on or off while testing).
  76. - Copy the current error message.
  77. - Step Into goes to the next line of code, and if it's a function, it step line by line through the function.
  78. - Step Over goes to the next line of code, but does not go down into function code.
  79. - Break pauses the game like a breakpoint would.
  80. - Continue resumes the game after a breakpoint or pause.
  81. Errors
  82. ++++++
  83. This is where errors and warning messages are printed while running the game.
  84. Profiler
  85. ++++++++
  86. Profiles the performance of any function call in the running game.
  87. Network Profiler
  88. ++++++++++++++++
  89. The Network Profiler contains a list of all the nodes that communicate over the multiplayer API
  90. and, for each one, some counters on the amount of incoming and outgoing network interactions.
  91. It also features a bandwidth meter that displays the total bandwidth usage at any given moment
  92. Monitors
  93. ++++++++
  94. The monitors are graphs of several aspects of the game while its running such as FPS, memory usage,
  95. how many nodes are in a scene and more. All monitors keep track of stats automatically, so even if one
  96. monitor isn't open while the game is running, you can open it later and see how the values changed.
  97. Video Mem
  98. +++++++++
  99. Video Mem list the video memory usage of the running game and which resource is using it.
  100. Misc
  101. ++++
  102. Miscellaneous options for debug.
  103. Remote in Scene dock
  104. --------------------
  105. When running a game in the editor two options appear at the top of the ``Scene`` dock,
  106. ``Remote`` and ``Local``. While using ``Remote`` you can inspect or change the nodes' parameters
  107. in the running game.
  108. .. image:: img/overview_remote.png
  109. .. note:: Some editor settings related to debugging can be found inside the ``Editor Settings``, under Network>Debug and Debugger sections.