"get_tree().reload_current_scene()" never gets executed
Godot4beta6. Doesn't work - await get_tree().create_timer(1.0).timeout
Try commenting-out the queue_free().
- Edited
so if "await" works, but I need to use queue_free()
is it bug?
Did commenting-out the queue_free() fix the problem?
- Edited
Then the problem is that the node needs to exist for a while in order for that code to work. Try moving the queue_free() after the "await".
DaveTheCoder
Yes, I understand, but this is to reload the scene after the player is destroyed. putting queue_free() after await no longer makes sense
- Best Answerset by icomputo
What about hiding the player immediately, and deferring the queue_free() until after the "await"?
DaveTheCoder
It works that way, thanks
@icomputo Is this from Heartbeast's 1-Bit Godot course? looks just like it and just so happens to be the exact thing I was working on when I encountered the issue.
Thanks for the suggested solution @DaveTheCoder . Once I realized that's what was happening, I created a workaround by moving the 'await timer' and 'reload scene' code into a function in the level's script, then simply called that function using get_parent(). Works like a charm now.