crystal-bit / godot-game-template

Generic template for Godot games
MIT License
631 stars 48 forks source link

_set_new_scene(): wait for old nodes to be completely removed from tree before starting a new scene #72

Closed davcri closed 2 years ago

davcri commented 2 years ago

https://github.com/crystal-bit/godot-game-template/blob/d094a332e52fb3d6d15611ac6d0519f299287821/addons/game-template/scenes.gd#L54-L63

Issue: a new scene can start before old nodes to be completely removed.

I noticed this reloading a scene which had get_tree().get_nodes_in_group("example_group") on ready: I was expecting 3 nodes, but I got 6. This happened because old nodes were not completely removed on reload.