How can I inspect the last line of code in a function using the debugger?

Godot Version

4.3.dev1

Question

I want to get used to debugging instead of printing. How can I inspect the variables of the last line of code in a function using the debugger? When I press F10, F11 or F12 my stack variables disappear.

In my years using Godot I still couldn’t find a way to do it normally.

What I do is I add a pass line to the end of the function so I can stop debugger there.

1 Like

Use the breakpoint keyword to add a breakpoint in code.

func _ready() -> void:
	var data = get_data()
	breakpoint # code will break here
2 Likes

Too bad you can’t turn it on and off, you have to remove the whole line, which triggers git changes.

1 Like

Too bad breakpoints like this one dont get triggered

image