Prints and Debugs in terminal
-
Prints the elements 'text_1' and 'text_2', separated by a 'space' between them:
-
prints('text_1', 'text_2')
-
-
Prints the elements 'text_1' and 'text_2' separated by 'tab':
-
printt('text_1', 'text_2')
-
-
Prints 'text' as an 'Error' message, with red highlight, printed in the Output area: (the
push_error()sounds more correct, as it references the lines of the 'error'.)-
printerr('text')
-
-
Prints 'text' as an 'Error' message, with red highlight and Engine indicators, printed in the Debugger area:
-
push_error('text')
-
-
Prints 'text' as a 'Warning' message, with yellow highlight and Engine indicators, printed in the Debugger area:
-
push_warning('text')
-
Useful code for debug with prints
var count := 0
func _process(_delta) -> void:
count += 1
if !count % 30: ## will print once every 30 frames.
print()
Skip a function or operation without crashing ('pass')
if true:
pass
func set_direction():
pass
Line break
if 2 == 2 \
and x != y \
and "psps" > "cat":
x = y
emit_signal("succeeded")
My configs for safety
-
Project Settings->Advanced Settings->debug/gdscript/warnings/. -
Unused Parameter.
-
Ignore
-
Reasonable to ignore since adding
_each time while prototyping is tedious.
-
-
Unused Signal.
-
Ignore
-
Important for Global Signals.
-
-
Untyped Declaration.
-
Warn
-
-
Unsafe Property Access.
-
Warn
-
-
Unsafe Method Access.
-
Warn
-
-
Unsafe Cast.
-
Warn
-
Unknown effect.
-
-
Unsafe Call Argument.
-
Warn
-
-
Int as Enum without Cast
-
Ignore
-
Annoying warning when testing enums.
-