godotengine / godotengine/godot
Function _exit_tree() is not called properly in editor mode
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
v4.3.stable
### System information
Godot v4.3.stable (77dcf97d8) - Windows 10.0.22621 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 4070 Ti (NVIDIA; 32.0.15.6094) - 13th Gen Intel(R) Core(TM) i5-13600KF (20 Threads)
### Issue description
```gdscript
extends Node2D
func _enter_tree() -> void:
print("_enter_tree")
pass
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
print("_ready")
pass # Replace with function body.
func _exit_tree() -> void:
print("_exit_tree")
pass
```
I expect the print result:
```gdscript
_enter_tree
_ready
_exit_tree
```
But currently the print result:
```gdscript
_enter_tree
_ready
```
### Steps to reproduce
Run the project in the editor and close the window.
Check the print results.
### Minimal reproduction project (MRP)
[bugtest.zip](https://github.com/user-attachments/files/17605660/bugtest.zip)
Contributor guide
Assessment
This issue has not been assessed yet.