Hey!

I just discovered the behavior of nodes in the tree that are not visible because visible is set to false, don't run the _exit_tree() function when you close the game window. This seems like intended behavior, but I don't understand if it's in the tree, there's a _exit_tree() function, why wouldn't it run that when exiting the tree? This blows my mind.

Quick google search didn't really show anything of interest. I'm looking to run code on 11 specific nodes upon pressing to close the game window (X button for the window itself), but only 2 are visible in the tree

I think that I understand I'll need to use the close request notification (if I can finally figure out everything about notifications like that in Godot as I have no experience there, I see how to notify, but not how to let a nodes script know what code to run in that case or any notifying case)

So why does _exit_tree() function only run on visible nodes?

  • Toxe replied to this.

    Knight_XAura So why does _exit_tree() function only run on visible nodes?

    Hmm, I would have expected it to do that. Did you try to manually remove those nodes from the tree just to check if this is really happening? Maybe they just won't get removed when quitting the game, which is actually what I would expect because why would nodes get removed from the tree just because we quit the game?