No output from `_exit_tree` unless breakpoint somewhere else?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By rakkarage
extends Control

func _enter_tree() -> void:

func _exit_tree() -> void:

func _notification(what: int) -> void:

i am having trouble seeing output from _exit_tree when i close my app in godot4… I see enter but can’t see exit unless I put breakpoint on second print("exit1")? then I see exit2?

Am I doing something wrong? Should i post a bug?


:bust_in_silhouette: Reply From: jgodfrey

I assume this is related to how often print statements are flushed. Ideally, they’d be flushed after each print, but that can be unacceptably slow (especially on some OSs), so they’re probably flushed less often by default - which leads to the case you describe (print output not flushed before app closes).

While I’m not entirely sure, there are a few Project Settings that might impact your results:

  • Project Settings
  • Turn on Advanced Settings switch
  • Under Application | Run
  • Flush stdout on Print
  • Flush stdout on Print.debug

Thanks for help.
I just tried this and it did not work…
It is on by default for print_debug i guess, but that does not work either…
Would have been an ideal solution.

rakkarage | 2023-06-29 22:55