Godot: debug_print option for printing stuff to the debugger window?

Created on 23 Aug 2016  路  5Comments  路  Source: godotengine/godot

Operating system or device - Godot version:
OS is N/A, Godot version? 2.0 and up I guess.

Issue description (what happened, and what was expected):
Inspired by https://twitter.com/ProbDenis/status/741981375604137984 - when running a game in debug mode (be it in the editor or using a debug-enabled export option), it'd be nice to have a print_debug command (or similar), so that certain types of messages don't get printed in a release game (if run from terminal or whatnot).

Functionally it should be identical to print as-is, other than it not printing to stdout but stderr.

archived feature proposal gdscript

Most helpful comment

Right now you can use if OS.is_debug_build(): print("text").

All 5 comments

Right now you can use if OS.is_debug_build(): print("text").

Hadn't been aware of the existence of OS.is_debug_build, nice to know something like that exists. But yes, a debug_print would be a little less work there all the same.

If you're looking to print to stderr, you can also use printerr().

@Gastronok The problem with printerr is that it won't show up in the editor at all, which decreases its utility a lot.

Since it is possible to easily implement this feature by adding a very short function to a singleton, I'm closing this. (It is also more flexible this way.)

Was this page helpful?
0 / 5 - 0 ratings