I'm trying to read an array content, but he depends on the keyboard input to update your values.

For this reason, don't work for me just pin the breakpoint directly in the editor. I want to activate the breakpoint or just stop the program if a conditional situation occurs.

There is a way to do that?

Thanks!

Apparently there is the breakpoint keyword (documentation), though I think it is on a per line basis, so the debugger will just stop once it reaches that line without any way to control when it stops.

While not a great solution, you may be able to pause the game to see what is happening. You can quit/close the application by calling get_tree().quit(), but for debugging that might not be helpful. Neither solution is ideal though, they are more workarounds than proper solutions. I'll keep an eye out for a better solution and if I find one I'll post it here.

Hi Duds

did you mean breakpoint or did you mean pass or return? return would "just stop the program" when it gets to certain conditional situation occur and it would return a var if you needed it to.

some examples below:

func my_func1(): # error if no function body

func my_func2(): # no error but just empty function
   pass # does nothing, but can do it later

func my_func3():
   for i in range(10):  # error if no statements for "for" loop
       pass # no error if "pass" syntax is here when no statements

func my_func4():
   pass # does nothing
   var x = 1 # this code executes

func my_func5():
   return # quit function
   var x = 1 # this code does not execute

func my_func5():
   return my_var # quit function and return a var
   var x = 1 # this code does not execute

There's also a literal breakpoint keyword in the gdscript syntax as TwistedTwigleg already mentioned. It should suffice. I find them pretty useful actually. When called, you get to see the current variables in the stack in the debug section at the bottom. Then you can just resume the program like normal.

It's this breakpoint keyword that I'm looking for! I looked in the documentation but didn`t pay attention.

Thanks for the help and sorry if I bad explained my question.

@Duds__ I've changed the topic into a question so you can pick the post with the best answer as answer to the OP/question.

@Megalomaniak said: @Duds__ I've changed the topic into a question so you can pick the post with the best answer as answer to the OP/question.

How I define a topic as question? (For the next time I write a new one.)

If you click the drop-down arrow next to New Discussion, you can choose Ask A Question, which will make the post a question instead of a discussion.

Or you can always just PM one of us to change it for you if you have created one over the other by accident. :)

@TwistedTwigleg @Megalomaniak You guys are so nice! I don't know how often people tell you this, but we really appreciate your work here. :)

3 years later