Blame

50ea2e lisa 2026-08-16 22:03:23
sd: add C08 reference (debugging & alpha testing) — 9 pages ported from C08-Reference-Godot; hub link Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1
<!-- Generated from applied-computing-au vic/unit3-4/sat/C08-2026/C08-Reference-Godot by port-reference-godot-to-wiki.py — do not hand-edit; re-run the port. -->
2
# Godot Debugging Tools — GDScript
3
4
*The 90-second tour of what Godot gives you for debugging. For the hands-on breakpoint workflow, see [Debugging with Breakpoints in Godot](/sd/C08/Debugging%20with%20Breakpoints%20in%20Godot).*
5
6
**Definition.** *Debugging* is finding and fixing the errors in your program: syntax errors (won't run), logic errors (runs, but the result is wrong) and run-time errors (crashes while running). The C8-1 rubric looks for **debugging statements** at level 3–4 and **breakpoints** at level 5–6 — used on your own project, not described in the abstract.
7
8
## Print debugging — the "debugging statements"
9
10
Everything prints to the **Output** panel at the bottom of the editor.
11
12
```gdscript
13
print("DEBUG: balance = ", balance) # always prints
14
print_debug("reached _apply_fare()") # adds the script and line number
15
push_warning("fare table is empty") # yellow warning in the Debugger
16
push_error("negative balance!") # red error in the Debugger (does not stop the game)
17
```
18
19
A debugging statement earns its keep when it answers a question: *what value does this variable hold? did this line run at all? in what order?* Comment it out once answered — the added-then-removed print in your git history is itself debugging evidence.
20
21
## The Debugger panel
22
23
Opens at the bottom when your game hits a breakpoint or crashes on an error.
24
25
| Where to look | What it shows |
26
|---|---|
27
| **Stack Trace / Stack Frames** | which function called which — where you are and how execution got there |
28
| **Locals** | every variable in the current function and its value *right now* |
29
| **Breakpoints** | every red dot in your project — jump to, disable or delete them |
30
| **Errors** | run-time errors and warnings, with clickable locations |
31
32
## Breakpoints
33
34
Click in the gutter left of a line number — a red dot appears. Run the scene; the game pauses on that line and the Debugger opens, with **Continue**, **Step Over** and **Step Into** buttons. Breakpoints survive editor restarts, and the `breakpoint` keyword in GDScript sets one from code. Full workflow: [Debugging with Breakpoints in Godot](/sd/C08/Debugging%20with%20Breakpoints%20in%20Godot).
35
36
## Two more worth knowing
37
38
- **Remote scene tree** — while the game runs, the Scene dock gains a **Remote** tab showing the *live* node tree; click any node to inspect (and even edit) its properties in real time.
39
- **Debug menu** (top of the editor) — *Visible Collision Shapes* draws your collision shapes in the running game; *Synchronize Script Changes* hot-reloads script edits without restarting.
40
41
## Watch
42
43
**Debugging Tips You MUST Know as a Godot Developer** (DevWorm, 5:27) — <https://www.youtube.com/watch?v=PB6YPnRAyjE> — advanced print statements at 02:23, breakpoints at 03:15.
44
45
Full detail: [Overview of debugging tools — official Godot docs](https://docs.godotengine.org/en/stable/tutorials/scripting/debug/overview_of_debugging_tools.html)