Skip to content

Commit 3283eae

Browse files
authored
Merge pull request #7271 from Calinou/gdscript-add-breakpoints
Document how to add breakpoints in the editor and using `breakpoint`
2 parents cbd464a + 698c40e commit 3283eae

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

tutorials/scripting/debug/debugger_panel.rst

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,24 @@ The Debugger tab opens automatically when the GDScript compiler reaches
1717
a breakpoint in your code.
1818

1919
It gives you a `stack trace <https://en.wikipedia.org/wiki/Stack_trace>`__,
20-
information about the state of the object, and buttons to control
21-
the program's execution.
20+
information about the state of the object, and buttons to control the program's
21+
execution. When the debugger breaks on a breakpoint, a green triangle arrow is
22+
visible in the script editor's gutter. This arrow indicates the line of code the
23+
debugger broke on.
24+
25+
.. tip::
26+
27+
You can create a breakpoint by clicking the gutter in the left of the script
28+
editor (on the left of the line numbers). When hovering this gutter, you
29+
will see a transparent red dot appearing, which turns into an opaque red dot
30+
after the breakpoint is placed by clicking. Click the red dot again to
31+
remove the breakpoint. Breakpoints created this way persist across editor
32+
restarts, even if the script wasn't saved when exiting the editor.
33+
34+
You can also use the ``breakpoint`` keyword in GDScript to create a
35+
breakpoint that is stored in the script iself. Unlike breakpoints created by
36+
clicking in the gutter, this keyword-based breakpoint is persistent across
37+
different machines when using version control.
2238

2339
You can use the buttons in the top-right corner to:
2440

@@ -32,6 +48,8 @@ You can use the buttons in the top-right corner to:
3248
- **Break**. This button pauses the game's execution.
3349
- **Continue**. This button resumes the game after a breakpoint or pause.
3450

51+
52+
3553
.. warning::
3654

3755
Breakpoints won't break on code if it's

tutorials/scripting/debug/overview_of_debugging_tools.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,20 @@ The script editor has its own set of debug tools for use with breakpoints and
8181
two options. The breakpoint tools can also be found in the **Debugger** tab
8282
of the debugger.
8383

84+
.. tip::
85+
86+
You can create a breakpoint by clicking the gutter in the left of the script
87+
editor (on the left of the line numbers). When hovering this gutter, you
88+
will see a transparent red dot appearing, which turns into an opaque red dot
89+
after the breakpoint is placed by clicking. Click the red dot again to
90+
remove the breakpoint. Breakpoints created this way persist across editor
91+
restarts, even if the script wasn't saved when exiting the editor.
92+
93+
You can also use the ``breakpoint`` keyword in GDScript to create a
94+
breakpoint that is stored in the script iself. Unlike breakpoints created by
95+
clicking in the gutter, this keyword-based breakpoint is persistent across
96+
different machines when using version control.
97+
8498
.. image:: img/overview_script_editor.webp
8599

86100
The **Break** button causes a break in the script like a breakpoint would.
@@ -93,6 +107,10 @@ has been closed.
93107
The **Debug with External Editor** option lets you debug your game with an external editor.
94108
This option is also accessible in **Editor Settings > Debugger**.
95109

110+
When the debugger breaks on a breakpoint, a green triangle arrow is visible in
111+
the script editor's gutter. This arrow indicates the line of code the debugger
112+
broke on.
113+
96114
.. warning::
97115

98116
Breakpoints won't break on code if it's

tutorials/scripting/gdscript/gdscript_basics.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ in case you want to take a look under the hood.
199199
+------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
200200
| var | Defines a variable. |
201201
+------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
202-
| breakpoint | Editor helper for debugger breakpoints. |
202+
| breakpoint | Editor helper for debugger breakpoints. Unlike breakpoints created by clicking in the gutter, ``breakpoint`` is stored in the script itself. |
203+
| | This makes it persistent across different machines when using version control. |
203204
+------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
204205
| preload | Preloads a class or variable. See `Classes as resources`_. |
205206
+------------+---------------------------------------------------------------------------------------------------------------------------------------------------+

0 commit comments

Comments
 (0)